n hobbits are planning to spend the night at Frodo's house. Frodo has n beds standing in a row and m pillows (n ≤ m). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as possible. Of course, it's not always possible to share pillows equally, but any hobbit gets hurt if he has at least two pillows less than some of his neighbors have. Frodo will sleep on the k-th bed in the row. What is the maximum number of pillows he can have so that every hobbit has at least one pillow, every pillow is given to some hobbit and no one is hurt?

The only line contain three integers n, m and k (1 ≤ n ≤ m ≤ 109, 1 ≤ k ≤ n) — the number of hobbits, the number of pillows and the number of Frodo's bed.

Print single integer — the maximum number of pillows Frodo can have so that no one is hurt.

NoteIn the first example Frodo can have at most two pillows. In this case, he can give two pillows to the hobbit on the first bed, and one pillow to each of the hobbits on the third and the fourth beds.In the second example Frodo can take at most four pillows, giving three pillows to each of the others.In the third example Frodo can take three pillows, giving two pillows to the hobbit in the middle and one pillow to the hobbit on the third bed.

import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Map.Entry;

public class Geometry {

	static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	public static void main(String[] args) {
		new Geometry().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;

	int maxA(int[] a) {
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < a.length; i++) {
			if (a[i] > max) {
				max = a[i];

			}
		}
		return max;
	}

	int minA(int[] a) {
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < a.length; i++) {
			if (a[i] < min) {
				min = a[i];

			}
		}
		return min;
	}

	void init() throws FileNotFoundException {

		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}

		tok = new StringTokenizer("");
	}

	void run() {
		try {
			long timeStart = System.currentTimeMillis();

			init();
			solve();

			out.close();

			long timeEnd = System.currentTimeMillis();
			System.err.println("Time = " + (timeEnd - timeStart) + " COMPILED");
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}

	long memoryTotal, memoryFree;

	void memory() {
		memoryFree = Runtime.getRuntime().freeMemory();
		System.err.println("Memory = " + ((-memoryTotal + memoryFree) >> 10) + " KB");
	}

	String readLine() throws IOException {
		return in.readLine();
	}

	String delimiter = " ";

	String rS() throws IOException {
		while (!tok.hasMoreTokens()) {
			String nextLine = readLine();
			if (null == nextLine)
				return null;

			tok = new StringTokenizer(nextLine);
		}

		return tok.nextToken(delimiter);
	}

	int[] rA(int b) {
		int a[] = new int[b];
		for (int i = 0; i < b; i++) {
			try {
				a[i] = rI();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return a;
	}

	int rI() throws IOException {
		return Integer.parseInt(rS());
	}

	long rL() throws IOException {
		return Long.parseLong(rS());
	}

	void sort(int[] a) {
		Integer arr[] = new Integer[a.length];
		for (int i = 0; i < a.length; i++) {
			arr[i] = a[i];
		}
		Arrays.sort(arr);
		for (int i = 0; i < a.length; i++) {
			a[i] = arr[i];
		}
	}

	void solve() throws IOException {
		long n = rI();
		long m = rI();
		long k = rI() - 1;
		long low = Math.max(Math.min(k, n - k - 1), 0);
		long dis = Math.max(k + 1, n - k);
		long l = 1;
		long r = m;
		long ans = 1;
		if (n == m) {
			out.println(1);
			return;
		}
		while (r >= l) {
			long full = m;
			full -= n;
			long mid = (r + l) / 2;
			long left = (Math.min(low, mid) - 1) * Math.min(low, mid) / 2;
			if (mid - 1 > low) {
				left += low * (mid - low);
			}
			long right = (Math.min(dis, mid) + 1) * Math.min(dis, mid) / 2;
			if (dis < mid) {
				right += dis * (mid - dis);
			}
			if (left + right > full) {
				r = mid - 1;

			} else {
				l = mid + 1;
				ans = mid+1;

			}
		}
		out.println((int) ans);

	}
}

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class B {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named A. */
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int k = scanner.nextInt();
//        int[] numPillow = new int[n];
        int numPillow = 1;
        int remainingPillow=m-n;
//        Arrays.fill(numPillow,1);
        k = k-1;
        int spreadLeft = 0;
        int spreadRight = 0;
        int leftSize = k-0;
        int rightSize = n-1 - k;
        int i=1;

            while(true){
                if(spreadLeft == leftSize && spreadRight==rightSize){
                    int temp = spreadLeft + spreadRight +1;
                    numPillow = numPillow+remainingPillow/temp;
                    remainingPillow = remainingPillow %temp;
                    break;
                }
                if(spreadLeft+spreadRight+1 > remainingPillow){
                    break;
                }else{

                    numPillow++;
                    remainingPillow = remainingPillow - spreadLeft-spreadRight-1;
                    if(spreadLeft<leftSize){
                        spreadLeft++;
                    }
                    if(spreadRight<rightSize){
                        spreadRight++;
                    }

                }

            }
        System.out.println(numPillow);

    }

}

import java.io.*;
import java.util.*;

import javax.print.attribute.HashAttributeSet;

import java.lang.*;
import java.math.*;
import java.text.DecimalFormat;
import java.lang.reflect.Array;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.security.cert.TrustAnchor;
public class Codeforces{
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static long MOD = (long)(1e9+7);
	//static int MOD = 998244353;
	static long MOD2 = MOD*MOD;
	static FastReader sc = new FastReader();
	static int pInf = Integer.MAX_VALUE;
	static int nInf = Integer.MIN_VALUE;
	public static void main(String[] args){
		int test = 1;
		//test = sc.nextInt();
		while(test-->0)solve();
		out.flush();
		out.close();
	}
	static long n,m,k;
	static boolean good(long x) {
		long l = 0;
		long r = 0;
		if(k>x-1) {
			l = (x*(x-1))/2+k-(x-1);
		}
		else{
			l = (((2*x)-k-1)*k)/2;
		}
		if(n-k-1>x-1) {
			r = (x*(x-1))/2+(n-k-1)-(x-1);
		}
		else {
			r = (((2*x)-(n-k-1)-1)*(n-k-1))/2;
		}
		return (l+r+x)<=m;
	}
	public static void solve() {
		n = sc.nextLong();
		m = sc.nextLong();
		k = sc.nextLong()-1;
		long l = 0;
		long r = m+1;
		while(r-l>1) {
			long mid = l+(r-l)/2;
			if(good(mid)) {
				l = mid;
			}
			else {
				r = mid;
			}
		}
		out.println(l);
	}
	static class Node{
		ArrayList<Node> connect = new ArrayList<>();
		int comp = -1;
		public int gsize() {
			return connect.size();
		}
	}
	static long nC2(long n) {
		return add((n*(n+1))/2, 0);
	}
	public static int maxRight(int x,int[] a) {
		int l = -1;      //a[l]<=x
		int r = a.length;//a[r]>x
		while(r-l>1) {
			int m = l+(r-l)/2;
			if(a[m]<=x) {
				l = m;
			}
			else {
				r = m;
			}
		}
		return l+1;
	}
	public static int minLeft(int x,int[] a) {
		int l = -1;      //a[l]<x
		int r = a.length;//a[r]>=x
		while(r-l>1) {
			int m = l+(r-l)/2;
			if(a[m]<x) {
				l = m;
			}
			else {
				r = m;
			}
		}
		return r+1;
	}
	public static int lowerBound(int key, int[] a) {
		int s = 0;
		int e = a.length-1;
		if(e==-1) {
			return 0;
		}
		int ans = -1;
		while(s<=e) {
			int m = s+(e-s)/2;
			if(a[m]>=key) {
				ans = m;
				e = m-1;
			}
			else {
				s = m+1;
			}
		}
		return ans==-1?s:ans;
	}
	public static int upperBound(int key, int[] a) {
		int s = 0;
		int e = a.length-1;
		if(e==-1) {
			return 0;
		}
		int ans = -1;
		while(s<=e) {
			int m = s+(e-s)/2;
			if(a[m]>key) {
				ans = m;
				e = m-1;
			}
			else {
				s = m+1;
			}
		}
		return ans==-1?s:ans;
	}
	public static long c2(long n) {
		if((n&1)==0) {
			return mul(n/2, n-1);
		}
		else {
			return mul(n, (n-1)/2);
		}
	}
	public static long mul(long a, long b){
	    return ((a%MOD)*(b%MOD))%MOD;
	}
	public static long add(long a, long b){
	    return ((a%MOD)+(b%MOD))%MOD;
	}
	public static long sub(long a, long b){
	    return ((a%MOD)-(b%MOD))%MOD;
	}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Integer.lowestOneBit(i)   Equals k where k is the position of the first one in the binary
//Integer.highestOneBit(i)  Equals k where k is the position of the last one in the binary
//Integer.bitCount(i)       returns the number of one-bits
//Collections.sort(A,(p1,p2)->(int)(p2.x-p1.x)) To sort ArrayList in descending order wrt values of x.
//            Arrays.parallelSort(a,new Comparator<TPair>() {
//      		public int compare(TPair a,TPair b) {
//        			if(a.y==b.y) return a.x-b.x;
//        			return b.y-a.y;
//        		}
//        	});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//PrimeFactors
    public static ArrayList<Long> primeFactors(long n) {
        ArrayList<Long> arr = new ArrayList<>();
        if (n % 2 == 0)
            arr.add((long) 2);
        while (n % 2 == 0)
            n /= 2;
        for (long i = 3; i <= Math.sqrt(n); i += 2) {
            int flag = 0;
            while (n % i == 0) {
                n /= i;
                flag = 1;
            }
            if (flag == 1)
                arr.add(i);
        }
        if (n > 2)
            arr.add(n);
        return arr;
    }
//Pair Class
    static class Pair implements Comparable<Pair>{
		int x;
		int y;
		int len;
		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
			this.len = y-x+1;
		}
		@Override
		public int compareTo(Pair o) {
			if(this.x==o.x){
			    return (this.y-o.y);
			}
			return -1*(this.x-o.x);
		}
	}
	static class TPair implements Comparable<TPair>{
		int l;
		int r;
		long index;
		public TPair(int l, int r, long index) {
			this.l = l;
			this.r = r;
			this.index = index;
		}
		@Override
		public int compareTo(TPair o) {
			if(this.l==o.l){
			    return (this.r-o.r);
			}
			return -1*(this.l-o.l);
		}
	}
//nCr
	static long[] facts, factInvs;
	static long exp(long base, long e) {
		if (e==0) return 1;
		long half=exp(base, e/2);
		if (e%2==0) return mul(half, half);
		return mul(half, mul(half, base));
	}

	static long modInv(long x) {
		return exp(x, MOD-2);
	}

	static void precomp() {
		facts=new long[1_000_000];
		factInvs=new long[1_000_000];
		factInvs[0]=facts[0]=1;
		for (int i=1; i<facts.length; i++)
			facts[i]=mul(facts[i-1], i);
		factInvs[facts.length-1]=modInv(facts[facts.length-1]);
		for (int i=facts.length-2; i>=0; i--)
			factInvs[i]=mul(factInvs[i+1], i+1);
	}

	static long nCk(int n, int k) {
		return mul(facts[n], mul(factInvs[k], factInvs[n-k]));
	}
//Kadane's Algorithm
    static long maxSubArraySum(ArrayList<Long> a) {
    	if(a.size()==0) {
    		return 0;
    	}
    	long max_so_far = a.get(0);
    	long curr_max = a.get(0);
    	for (int i = 1; i < a.size(); i++) {
           curr_max = Math.max(a.get(i), curr_max+a.get(i));
           max_so_far = Math.max(max_so_far, curr_max);
    	}
    	return max_so_far;
    }
//Shuffle Sort
    static final Random random=new Random();
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
//Merge Sort
	static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
//Brian Kernighans Algorithm
    static long countSetBits(long n){
        if(n==0) return 0;
        return 1+countSetBits(n&(n-1));
    }
//Factorial
    static long factorial(long n){
        if(n==1) return 1;
        if(n==2) return 2;
        if(n==3) return 6;
        return n*factorial(n-1);
    }
//Euclidean Algorithm
    static long gcd(long A,long B){
        if(B==0) return A;
        return gcd(B,A%B);
    }
//Modular Exponentiation
    static long fastExpo(long x,long n){
        if(n==0) return 1;
        if((n&1)==0) return fastExpo((x*x)%MOD,n/2)%MOD;
        return ((x%MOD)*fastExpo((x*x)%MOD,(n-1)/2))%MOD;
    }
//AKS Algorithm
    static boolean isPrime(long n){
        if(n<=1) return false;
        if(n<=3) return true;
        if(n%2==0 || n%3==0) return false;
        for(int i=5;i<=Math.sqrt(n);i+=6)
            if(n%i==0 || n%(i+2)==0) return false;
        return true;
    }
//Reverse an array
    static <T> void reverse(T arr[],int l,int r){
    	Collections.reverse(Arrays.asList(arr).subList(l, r));
    }
  //Print array
    static void print1d(long arr[]) {
    	out.println(Arrays.toString(arr));
    }
    static void print2d(int arr[][]) {
    	for(int a[]: arr) out.println(Arrays.toString(a));
    }
//Sieve of eratosthenes
    static int[] findPrimes(int n){
        boolean isPrime[]=new boolean[n+1];
        ArrayList<Integer> a=new ArrayList<>();
        int result[];
        Arrays.fill(isPrime,true);
        isPrime[0]=false;
        isPrime[1]=false;
        for(int i=2;i*i<=n;++i){
            if(isPrime[i]==true){
                for(int j=i*i;j<=n;j+=i) isPrime[j]=false;
            }
        }
        for(int i=0;i<=n;i++) if(isPrime[i]==true) a.add(i);
        result=new int[a.size()];
        for(int i=0;i<a.size();i++) result[i]=a.get(i);
        return result;

    }
//Indivisual factors of all nos till n
    static ArrayList<Integer>[] indiFactors(int n){
    	ArrayList<Integer>[] A = new ArrayList[n+1];
    	for(int i = 0; i <= n; i++) {
    		A[i] = new ArrayList<>();
    	}
    	int[] sieve = new int[n+1];
    	for(int i=2;i<=n;i++) {
       		if(sieve[i]==0) {
       			for(int j=i;j<=n;j+=i) if(sieve[j]==0) {
       				//sieve[j]=i;
       				A[j].add(i);
       			}
       		}
       	}
    	return A;
    }
//Segmented Sieve
    static boolean[] segmentedSieve(long l, long r){
    	boolean[] segSieve = new boolean[(int)(r-l+1)];
    	Arrays.fill(segSieve, true);
    	int[] prePrimes = findPrimes((int)Math.sqrt(r));
    	for(int p:prePrimes) {
    		long low = (l/p)*p;
    		if(low < l) {
    			low += p;
    		}
    		if(low == p) {
    			low += p;
    		}
    		for(long j = low; j<= r; j += p) {
    			segSieve[(int) (j-l)] = false;
    		}
    	}
    	if(l==1) {
    		segSieve[0] = false;
    	}
    	return segSieve;
    }
//Euler Totent function
    static long countCoprimes(long n){
        ArrayList<Long> prime_factors=new ArrayList<>();
        long x=n,flag=0;
        while(x%2==0){
            if(flag==0) prime_factors.add(2L);
            flag=1;
            x/=2;
        }
        for(long i=3;i*i<=x;i+=2){
            flag=0;
            while(x%i==0){
                if(flag==0) prime_factors.add(i);
                flag=1;
                x/=i;
            }
        }
        if(x>2) prime_factors.add(x);
        double ans=(double)n;
        for(Long p:prime_factors){
            ans*=(1.0-(Double)1.0/p);
        }
        return (long)ans;
    }
	static long modulo = (long)1e9+7;
	public static long modinv(long x){
	    return modpow(x, modulo-2);
	}
	public static long modpow(long a, long b){
	    if(b==0){
	        return 1;
	    }
	    long x = modpow(a, b/2);
	    x = (x*x)%modulo;
	    if(b%2==1){
	        return (x*a)%modulo;
	    }
	    return x;
	}
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
}

import java.io.*;

public class Hobbit{
	public static void main(String[] args)throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String[] temp = in.readLine().split(" ");

		long n = Long.parseLong(temp[0]);
		long m = Long.parseLong(temp[1]);
		long k = Long.parseLong(temp[2]);

		long left = k - 1;
		long right = n - k;

		long l = 1;
		long h = m;
		long count;
		long save = 1;

		while(l <= h){
			long mid = (l+h)/2;
			//System.out.println(l + ", " + h + ", " + mid);

			if(left < mid - 1){
				count = (left * (2 * (mid-1) - left + 1)) / 2;
			}
			else{
				count = ((mid-1) * mid) / 2 + (left - mid + 1);
			}

			if(right < mid - 1){
				count += (right * (2 * (mid-1) - right + 1)) / 2;
			}
			else{
				count += ((mid-1) * mid) / 2 + (right - mid + 1);
			}

			if(count + mid == m){
				//System.out.println("equal");
				save = mid;
				break;
			}
			else if(count + mid > m){
				//System.out.println("niche aa");
				h = mid - 1;
			}else{
				//System.out.println("uper jaa");
				save = mid;
				l = mid + 1;
			}
		}

		System.out.println(save);
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskCF393D2B solver = new TaskCF393D2B();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskCF393D2B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int k = in.nextInt();

            int min = 1;
            int max = m - n + 1;

            int maxPossible = 0;

            while (min <= max) {
                int mid = (min + max) / 2;

                if (possible(mid, n, m, k)) {
                    maxPossible = Math.max(maxPossible, mid);
                    min = mid + 1;
                } else {
                    max = mid - 1;
                }
            }
            out.println(maxPossible);
        }

        private boolean possible(long mid, long n, long m, long k) {
            return (m >= mid + sum(mid, k) + sum(mid, n - k + 1));
        }

        private long sum(long a, long k) {
            long s = (a - 1) * a / 2;

            if (k >= a) {
                s += k - 1 - (a - 1);
            } else if (k < a) {
                s -= (a - k) * (a - k + 1) / 2;
            }
            return s;
        }

    }
}

import java.util.*;

public class CF760B {
	public static void main(String[] args){

		// getting inputs
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(); // number of bed and hobbits
		int m = in.nextInt(); // number of pillows
		int k = in.nextInt(); // where Frodo sleep. kth bed

		int result = 1;
		m -= n;

		int frodoAndNeighbors = 1;
		int range = 0;

		while(m >= frodoAndNeighbors){
			if(frodoAndNeighbors == n){
				result += m / n;
				break;
			} else {
				result++;
				m -= frodoAndNeighbors;

				range++;
				if(k - range > 0)
					frodoAndNeighbors++;
				if(k + range <= n)
					frodoAndNeighbors++;
			}
		}
		System.out.println(result);
	}
}

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {

        new Main().solve();
    }

    int inf = 1000000000;
    int mod = 1000000007;
    double eps = 0.0000000001;

    PrintWriter out;

    int n;
    int m;

    void solve() throws IOException {

        Reader in;
        BufferedReader br;

        try {

            br = new BufferedReader( new FileReader("input.txt") );
            in = new Reader("input.txt");
            out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );
        }
        catch (Exception e) {

            br = new BufferedReader( new InputStreamReader( System.in ) );
            in = new Reader();
            out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );
        }

        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int k2 = n-k+1;

        int l = 1;
        int r = m;

        int ans = 0;

        while (l <= r) {

            int x = (l+r)/2;

            long sum = x;

            if (k > 1)
                sum += sum(Math.max(1, x-k+1), x-1);
            if (k > x)
                sum += (k-x);

            if (k2 > 1)
                sum += sum(Math.max(1, x-k2+1), x-1);
            if (k2 > x)
                sum += (k2-x);

            //System.err.println(x+" "+sum+" "+k+" "+k2);

            if (sum <= m) {

                ans = x;
                l = x+1;
            }
            else {

                r = x-1;
            }

        }

        out.print(ans);
        out.flush();
        out.close();
    }

    long sum(int l, int r) {

        l--;

        if (l > r)
            return 0;

        long s1 = 1l*r*(r+1)/2;
        long s2 = 1l*l*(l+1)/2;

        return s1-s2;
    }

    class Pair implements Comparable<Pair>{

        int a;
        int b;

        Pair(int a, int b) {

            this.a = a;
            this.b = b;
        }

        public int compareTo(Pair p) {

            return 0;
        }
    }

    class Item {

        int a;
        int b;
        int c;

        Item(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

    }

    class Reader {

        BufferedReader  br;
        StringTokenizer tok;

        Reader(String file) throws IOException {
            br = new BufferedReader( new FileReader(file) );
        }

        Reader() throws IOException {
            br = new BufferedReader( new InputStreamReader(System.in) );
        }

        String next() throws IOException {

            while (tok == null || !tok.hasMoreElements())
                tok = new StringTokenizer(br.readLine());
            return tok.nextToken();
        }

        int nextInt() throws NumberFormatException, IOException {
            return Integer.valueOf(next());
        }

        long nextLong() throws NumberFormatException, IOException {
            return Long.valueOf(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.valueOf(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

    }

}

import java.util.*;

public class Frodo_and_pillows {

	public static boolean works(double n, long m, double k, double x) {

		if (x - 1 >= k) {
			m -= k / 2 * (x - k + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
			m -= k - x;
		}
		if (x - 1 >= n - k + 1) {
			m -= (n - k + 1) / 2 * (x - (n - k + 1) + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
			m -= (n - k + 1) - x;
		}
		m += x;

		// System.out.println(x + " " + m);

		return m >= 0 ? true : false;

	}

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		double n = input.nextInt();
		long m = input.nextInt();
		double k = input.nextInt();

		input.close();

		int lo = 1;
		int hi = 1000000007;

		while (lo < hi - 1) {
			int mid = (lo + hi) / 2;
			if (works(n, m, k, mid)) {
				lo = mid;
			} else {
				hi = mid;
			}
		}

		System.out.println(lo);

	}

}

import java.util.*;
import java.lang.*;
import java.io.*;

public class line
{
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		int k = s.nextInt();
		int left = k-1;
		int right = n-k;
		int tleft = 0;
		int tright = 0;
		m = m- n;
		int ans = 1;
		if(n==1){
		    ans += m;
		    m=0;
		}
		while(m>0){
			ans++;
			if(tleft<left) {
				tleft++;
			}
			if(tright<right) {
				tright++;
			}
			m = m-tleft-tright-1;
		}
		System.out.println(ans);
	}
}

import java.util.*;
import java.io.*;
public class Maximus {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
           m -= n;
        int min = Math.min(n - k + 1,k);
        int cnt = 0;
        int start = 1;
        while(cnt < min && m >= start){
            start = 2*cnt + 1;
            ++cnt;
            m -= start;
        }
        if(m < 0)--cnt;
        //System.out.println(min + " " + cnt + " " + start + " " + m);
        if(start < n)++start;
        while(cnt >= min && m >= start && start < n){
            ++cnt;
            m -= start;
            start = Math.min(start + 1,n);
        }
        cnt += m/start;
        System.out.print(1 + cnt);
    }
}

import java.util.*;
import java.io.*;

public class Solution{

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static boolean check(long n, long m, long k, long p){
        //if(p<m) return false;

        long l1 = Math.min(m, k-1);
        long l2 = Math.min(m, n-k);

        long ans = m*l1-(l1*(l1+1))/2;
        ans += m*l2-(l2*(l2+1))/2;

        //System.out.println(m+" "+ans+" "+p);
        return (ans<=p);
    }

    static long bs(long n, long m, long k){
        long l=0, r=m+1, mid=0, ans=0;

        while(l<=r){
            mid = (l+r)/2;

            if(check(n, mid, k, m-mid)){
                ans = Math.max(ans, mid);
                l = mid+1;
            }else{
                r = mid-1;
            }

        }

        return ans;
    }

    public static void main (String[] args) throws IOException {
        FastReader sc = new FastReader();
        long n = sc.nextLong();
        long m = sc.nextLong();
        long k = sc.nextLong();

        long res = bs(n, m-n, k);
        System.out.println(res+1);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Wolfgang Beyer
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        int n;
        int m;
        int k;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            m = in.nextInt();
            k = in.nextInt();

            int left = 1;
            int right = m;
            while (left <= right) {
                int mid = (left + right) / 2;
                if (pillowsNeeded2(mid) > m) {
                    right = mid - 1;
                } else {
                    left = mid + 1;
                }
            }
            out.println(right);
        }

        public long pillowsNeeded2(long x) {
            long result = x;
            result += pillowsSingleSide(x - 1, k - 1);
            result += pillowsSingleSide(x - 1, n - k);
            return result;
        }

        public long pillowsSingleSide(long h, long w) {
            if (w >= h) {
                return (h + 1) * h / 2 + (w - h);
            } else {
                return (h + h - w + 1) * w / 2;
            }
        }

    }

    static class InputReader {
        private static BufferedReader in;
        private static StringTokenizer tok;

        public InputReader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            try {
                while (tok == null || !tok.hasMoreTokens()) {
                    tok = new StringTokenizer(in.readLine());
                }
            } catch (IOException ex) {
                System.err.println("An IOException was caught :" + ex.getMessage());
            }
            return tok.nextToken();
        }

    }
}

import java.util.Scanner;

public class fpillows {

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String bedS = scan.next();
		String pillowS = scan.next();
		String frodoS = scan.next();
		scan.close();
		int beds = Integer.parseInt(bedS);
		int frodo = Integer.parseInt(frodoS);
		int pillows = Integer.parseInt(pillowS) - beds;
		int baseline = 1;
		int toDecrease = 0;
		int counter = 0;
		if(beds == 1)
		{
			System.out.print(pillows + 1);
			return;
		}
		while(pillows >= 0)
		{
			toDecrease = 1;
			if(frodo + counter <= beds)
			{
				toDecrease += counter;
			}
			else
			{
				toDecrease += beds - frodo;
			}
			if(frodo - counter >= 1)
			{
				toDecrease += counter;
			}
			else
			{
				toDecrease += frodo - 1;
			}
			pillows = pillows - toDecrease;
			baseline++;
			counter++;
		}
		baseline--;
		System.out.print(baseline + " ");
	}

}

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    private static Scanner scan = new Scanner(System.in);
    private static PrintStream out = new PrintStream(System.out);
    static int n, m, k;

    public static void main (String[] args) throws IOException {
        n = scan.nextInt();
        m = scan.nextInt();
        k = scan.nextInt();
        m -= n;
        if (n == 1) {out.println(m + n); return;}

        int c = 1;
        int count = 1;
        int left = k, right = k;

        while (true) {
           //out.println(left + " " + right + " " + m + " " + c);
           if (m < c) break;

           m -= c;
           count++;

           if (left != 1) c++;
           if (right != n) c++;
           if (left != 1) left--;
           if (right != n) right++;
           if (left == 1 && right == n) c = n;
           if (c == n) {
               count += (m / c);
               break;
           }
        }
        out.println(count);
    }
}

import java.util.*;
import java.io.*;

public class CF760B{
  public static long n,m,k;
  public static void main(String[] args)throws Exception {
    InputReader in = new InputReader(System.in);
    PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
    n = in.nextLong();
    m = in.nextLong();
    k = in.nextLong();

   // pw.println(check(in.nextInt())+n);

    pw.println(BS());

    pw.close();
  }

  static long BS(){
    long lo  = 0, hi = 50+(long)1e9, mid = (lo+hi)/2l;
    long temp = 0;
    while(lo < hi){
      mid = (lo+hi)/2l;
      temp = check(mid) + n;  //System.err.println(mid+" "+check(mid)+" "+temp);
      if( temp > m) hi = mid;
      else lo = mid+1l;
    }
    if(check(lo) + n > m) return lo-1l;
    return lo; //returns the lowest index where arr[lo] >= num;
  }

  static long rightSum(long x){
    if(k+1l > n) return 0;
    long q1 = nthSum(x);
    long r = n - k; //System.err.println(q1+" "+x+" "+k+ " " +r);
    if(x > r){
      q1 -= nthSum(x-r);
    }
    return q1;
  }

  static long leftSum(long x){
    long q = nthSum(x);
    if(x > k){
     q -= nthSum(x-k);
    }
    //System.err.println(x+" "+(x>k)+" "+q);
    return q;
  }

  static long check(long mid){
    mid--;
    return leftSum(mid) + rightSum(mid-1l);

  }

  static long nthSum(long x){
    return (x*(x+1))/2l;
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream));
      tokenizer = null;
    }

    public String next()throws Exception {
      while (tokenizer == null || !tokenizer.hasMoreTokens())
        tokenizer = new StringTokenizer(reader.readLine());
      return tokenizer.nextToken();
    }

    public String nextLine()throws Exception {
      String line = null;
      tokenizer = null;
      line =  reader.readLine();
      return line;
    }

    public int nextInt()throws Exception {
      return Integer.parseInt(next());
    }

    public double nextDouble() throws Exception{
      return Double.parseDouble(next());
    }

    public long nextLong()throws Exception {
      return Long.parseLong(next());
    }

  }
}

import java.util.Scanner;

public class B8VCFinals2017 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt(), M = scan.nextInt(), K = scan.nextInt();

		M-=N;
		int count = 0;

		while(M>0){
			if(K-count<=0&&K+count>N){
				count+=M/N;
				break;
			}
			M-=(count+1)*2-1;
			if(K-count<=0){
				M+=(0-(K-count)+1);
			}
			if(K+count>N){
				M+=(K+count-N);
			}
			if(M<0)break;
			count++;
		}
		System.out.println(count+1);
	}
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();

        m -= n;

        int l = 0, r = m;
        while (l < r) {
            int mid = (l+r+1)/2;
            long sum = sum(mid, k, n);
            if (sum > 1l*m-mid) {
                r = mid-1;
            } else {
                l = mid;
            }
        }
        //if (sum(l+1, k, n) <= 1l*m-l-1) l++;
        System.out.println(l+1);
        /*
        int res = 0;
        while (sum(res, k, n) <= m-res) {
            res++;
          //  System.out.println("k="+res + " sum="+sum(res, k, n));
        }
        System.out.println(res);
        */
    }

    private static long sum(int res, int k, int n) {
        int ak = res - 1;
        if (ak < 0) return 0;

        int cnt = ak;
        int cntl = Math.min(k-1, cnt);
        int cntr = Math.min(n-k, cnt);
        int a1 = res - (cntl);
        int an = res - (cntr);

        long resl = (a1+ak)*1l*cntl/2;
        long resr = (ak+an)*1l*cntr/2;
        return resr + resl;
    }
}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
}

class Task {

//    static int MAX = 1000001;
//    int[] w;
//    boolean[] used;
//    List<List<Integer>> g = new ArrayList<>();
int max;
    int min;
    public void solve(Scanner in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt() - n;
        int k = in.nextInt();
        max = Math.max(k, n - k + 1);
        min = Math.min(k, n - k + 1);
//        int[] a = new int[n];
//        for (int i = 0; i < n; i++) {
//            a[i] = in.nextInt();
//        }
//        long minSum = sum(1, max) + sum(max - min + 1, max - 1);
//        if (m >= minSum) {
//            (m - minSum) /
//        }

        int s = 0;
        int f = 1000000000;
        while (f > s) {
            int mid = (s + f) / 2;
            if (f(mid) > m) {
                f = mid - 1;
            } else if (f(mid) <= m) {
                s = mid + 1;
            }
        }
        if (f(s) > m) {
            s--;
        }
        System.out.println(s+1);
    }

    long sum(int a, int b) {
        if (a > b) {
            return 0;
        }
        int d = b - a;
        long r = (long)(d + 1) * (long)(d + 2) / 2;
        return r + (long)(d + 1) * (long)(a - 1);
    }

    long f(int h) {
        long r = sum(1, h) * 2 - h;
        if (min < h) {
            r -= sum(1, h - min);
        }
        if (max < h) {
            r -= sum(1, h-max);
        }
//        System.out.println(h +" ->" + r);
        return r;
    }

}

class Utils {

    public static int binarySearch(int[] a, int key) {
        int s = 0;
        int f = a.length;
        while (f > s) {
            int mid = (s + f) / 2;
            if (a[mid] > key) {
                f = mid - 1;
            } else if (a[mid] <= key) {
                s = mid + 1;
            }
        }
        return -1;
    }
}

class Pair<T, U> {
    public T a;
    public U b;

    public Pair(T a, U b) {
        this.a = a;
        this.b = b;
    }

    @Override
    public boolean equals(Object obj) {
        Pair<T, U> p = (Pair<T, U>) obj;
        return p.a.equals(a) || p.a.equals(b);
    }

    @Override
    public int hashCode() {
        return 42;
    }
}

class Vect {
    public int a;
    public int b;

    public Vect(int a, int b) {
        this.a = a;
        this.b = b;
    }
}

class Triple<T, U, P> {
    public T a;
    public U b;
    public P c;

    public Triple(T a, U b, P c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    private String tryReadNextLine() {
        try {
            return in.readLine();
        } catch (Exception e) {
            throw new InputMismatchException();
        }
    }

    public String nextToken() {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(next());
        }
        return tok.nextToken();
    }

    public String next() {
        String newLine = tryReadNextLine();
        if (newLine == null)
            throw new InputMismatchException();
        return newLine;
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }
}

import java.io.*;
import java.util.*;

public class ProblemB {

    public static void main(String[] args) throws IOException {
        init();
        new ProblemB().run();
        out.flush();
        out.close();
    }

    static void init() throws IOException {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in.ordinaryChars(0, 65535);
        in.wordChars(0, 65535);
        in.whitespaceChars(' ', ' ');
        in.whitespaceChars('\n', '\n');
        in.whitespaceChars('\r', '\r');
    }

    // класс для пар
    class Pair<L, R> {
        private final L X;
        private final R Y;

        public Pair(L X, R Y) {
            this.X = X;
            this.Y = Y;
        }

        public L getX() {
            return X;
        }

        public R getY() {
            return Y;
        }

        @Override
        public int hashCode() {
            return X.hashCode() ^ Y.hashCode();
        }

        @Override
        public boolean equals(Object o) {
            if (!(o instanceof Pair)) return false;
            Pair pairo = (Pair) o;
            return X.equals(pairo.getX()) && Y.equals(pairo.getY());
        }
    }

    static final long INFL = 200000000000000000L;
    static final int INF = 2000000000;
    static final boolean DEBUG = true;

    static StreamTokenizer in;
    static PrintWriter out;

    static void print(String s) {
        print(s, 0);
    }

    static void print(String s, int debug) {
        if (debug == 0 || DEBUG) {
            out.print(s);
        }
    }

    static void println(String s) {
        println(s, 0);
    }

    static void println(String s, int debug) {
        if (debug == 0 || DEBUG) {
            out.println(s);
        }
    }

    static void printArray(int[] arr) {
        println(Arrays.toString(arr));
    }

    static void printArray(char[] arr) {
        println(Arrays.toString(arr));
    }

    static void printArray(String[] arr) {
        println(Arrays.toString(arr));
    }

    static void sort(int[] a) {
        Random rnd = new Random();
        for (int i = a.length - 1; i > 0; i--) {
            int index = rnd.nextInt(i);
            a[i] ^= a[index];
            a[index] ^= a[i];
            a[i] ^= a[index];
        }
        Arrays.sort(a);
    }

    static char[] inChars;
    static int inCharsInd;

    static String next() throws IOException {
        in.nextToken();
        return in.sval;
    }

    static char nextChar() throws IOException {
        while (inChars == null || inCharsInd >= inChars.length) {
            inChars = next().toCharArray();
            inCharsInd = 0;
        }
        return inChars[inCharsInd++];
    }

    static int nextInt() throws IOException {
        return Integer.valueOf(next());
    }

    static double nextDouble() throws IOException {
        return Double.valueOf(next());
    }

    static long nextLong() throws IOException {
        return Long.valueOf(next());
    }

    private void run() throws IOException {
        solve();
    }

    int K, L, M, N, P;

    private void solve() throws IOException {
        N = nextInt();
        M = nextInt();
        K = nextInt();
        M = M - N;

        int answer = 1;
        int radius = 0;
        int curplus = 1;
        int left = K;
        int right = K;

        int newleft, newright;
        while (M >= 0){
            if (M >= curplus){
                M -= curplus;
                answer++;
                newleft = Math.max(left-1, 1);
                newright = Math.min(right+1, N);
//                System.out.println("left = " + left);
//                System.out.println("right = " + right);
                if (newleft == left && newright == right){
                    int incr = M/N;
//                    System.out.println("M = " + M);
//                    System.out.println("incr = " + incr);
                    answer += incr;
                    break;
                } else {
                    left = newleft; right = newright;
                    curplus = right - left + 1;
                }
            } else {
                break;
            }
        }
        out.println(answer);

    }

}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
	static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	private final static Random rnd = new Random();
	final static long INF = Long.MAX_VALUE;

	boolean checkIndex(int index, int size) {
		return (0 <= index && index < size);
	}

	class Edge {
		int to;
		long w;

		void Edge(int to, long w) {
			this.to = to;
			this.w = w;
		}
	}

	// ======================================================
	int n;
	List<Edge> graph[];
	int[] parents;

	// ======================================================
	void solve() throws IOException {
		long n = rI();
		long m = rI();
		long k = rI();

		long l = 0;
		long r = m;
		long ans = 0;
		m -= n;
		ans++;
		while (l <= r) {
			long mid = (l + r) / 2;
			if (can(mid, n, m, k)) {
				ans = mid;
				l = mid + 1;
			} else {
				r = mid - 1;
			}

		}
		out.println(ans + 1);

	}

	// =======================================================
	boolean can(long mid, long n, long m, long k) {
		long l = 0;
		long r = 0;
		if (mid > k) {
			l = (k - 1) * (mid - k) + (k - 1) * (k) / 2;
		} else {
			l = mid * (mid - 1) / 2;
		}
		if (mid > n - k) {
			r = (n - k + 1) * (mid - n + k - 1) + (n - k + 1) * (n - k + 2) / 2;
		} else {
			r = (mid + 1) * mid / 2;
		}
		return l + r <= m;
	}

	// =======================================================
	void initGraph(int n) {
		for (int i = 0; i < n; i++) {
			graph[i] = new ArrayList<Edge>();
		}
	}

	// ---------------------------------

	// --------------------------------
	long[] dijkstra(int start) {
		long[] distances = new long[n];
		Arrays.fill(distances, INF);
		Arrays.fill(parents, -1);
		class Vertex implements Comparable<Vertex> {
			int index;
			long distance;

			Vertex(int index, long distance) {
				this.index = index;
				this.distance = distance;
			}

			public int compareTo(Vertex other) {
				return Long.compare(this.distance, other.distance);
			}
		}
		Queue<Vertex> q = new PriorityQueue<>();
		distances[start] = 0;
		q.add(new Vertex(start, distances[start]));
		while (q.size() > 0) {
			Vertex vertex = q.poll();
			if (vertex.distance > distances[vertex.index])
				continue;
			int from = vertex.index;
			long fromDistance = distances[from];
			for (Edge e : graph[from]) { // e = { to, w }
				int to = e.to;
				long fromToDistance = fromDistance + e.w;
				if (distances[to] > fromToDistance) {
					distances[to] = fromToDistance;
					parents[to] = from;
					q.add(new Vertex(to, distances[to]));
				}
			}
		}

		return distances;
	}

	int min(int... values) {
		int min = Integer.MAX_VALUE;
		for (int value : values) {
			min = Math.min(min, value);
		}
		return min;
	}

	int max(int... values) {
		int max = Integer.MIN_VALUE;
		for (int value : values) {
			max = Math.max(max, value);
		}
		return max;
	}
	// ==============================================================================
	// class DSU {
	//
	// int parent[];
	// int size;
	//
	// DSU(int size) {
	// this.size = size;
	// this.parent = new int[size];
	// for (int i = 0; i < size; i++) {
	// parent[i] = i;
	// sizes[i] = 1;
	// }
	// }
	//
	// int get(int v) {
	// int paren = parent[v];
	// if (paren == v)
	// return v;
	// return parent[v] = get(paren);
	// }
	//
	// void union(int a, int b) {
	// a = get(a);
	// b = get(b);
	// if (a != b) {
	// size--;
	// if (rnd.nextBoolean()) {
	// parent[a] = b;
	// sizes[b] += sizes[a];
	// } else {
	// parent[b] = a;
	// sizes[a] += sizes[b];
	// }
	//
	// }
	// }
	//
	// }

	public static void main(String[] args) {
		new Main().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;

	int maxA(int[] a) {
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < a.length; i++) {
			if (a[i] > max) {
				max = a[i];

			}
		}
		return max;
	}

	int minA(int[] a) {
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < a.length; i++) {
			if (a[i] < min) {
				min = a[i];
			}
		}
		return min;
	}

	void init() throws FileNotFoundException {

		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}

		tok = new StringTokenizer("");
	}

	void run() {
		try {
			long timeStart = System.currentTimeMillis();

			init();
			solve();

			out.close();

			long timeEnd = System.currentTimeMillis();
			System.err.println("Time = " + (timeEnd - timeStart) + " COMPILED");
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}

	long memoryTotal, memoryFree;

	void memory() {
		memoryFree = Runtime.getRuntime().freeMemory();
		System.err.println("Memory = " + ((-memoryTotal + memoryFree) >> 10) + " KB");
	}

	String readLine() throws IOException {
		return in.readLine();
	}

	String delimiter = " ";

	String rS() throws IOException {
		while (!tok.hasMoreTokens()) {
			String nextLine = readLine();
			if (null == nextLine)
				return null;

			tok = new StringTokenizer(nextLine);
		}

		return tok.nextToken(delimiter);
	}

	int[] rA(int b) {
		int a[] = new int[b];
		for (int i = 0; i < b; i++) {
			try {
				a[i] = rI();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return a;
	}

	int rI() throws IOException {
		return Integer.parseInt(rS());
	}

	long rL() throws IOException {
		return Long.parseLong(rS());
	}

	void sort(int[] a) {
		Integer arr[] = new Integer[a.length];
		for (int i = 0; i < a.length; i++) {
			arr[i] = a[i];
		}
		Arrays.sort(arr);
		for (int i = 0; i < a.length; i++) {
			a[i] = arr[i];
		}
	}

}

import java.io.*;
import java.util.*;

public class B {
	static Scanner is = new Scanner(System.in);

	public static void main(String [] args) {
		final long nHobbits = is.nextInt(), nPillows = is.nextInt(), k = is.nextInt() - 1;

		long left = 1, right = nPillows - nHobbits + 1;
		if (required(right, nHobbits, k) <= nPillows) {
			System.out.println(right);
			return;
		}
		while (right - left > 1) {
			long mid = (left + right) / 2;
			long diff = nPillows - required(mid, nHobbits, k);
			if (diff >= 0) {
				left = mid;
			} else {
				right = mid;
			}
		}

		System.out.println(left);
	}

	static long required(long frodoPillows, long nHobbits, long k) {
		final long needOnLeft = (frodoPillows > k) ?
				sequenceSum(frodoPillows - k, frodoPillows - 1) :
				sequenceSum(1, frodoPillows - 1) + k - frodoPillows + 1;
		final long nHobbitsOnRight = nHobbits - k - 1;
		final long needOnRight = (frodoPillows > nHobbitsOnRight) ?
				sequenceSum(frodoPillows - nHobbitsOnRight, frodoPillows - 1) :
				sequenceSum(1, frodoPillows - 1) + nHobbitsOnRight - frodoPillows + 1;

		return frodoPillows + needOnLeft + needOnRight;
	}

	static long sequenceSum(long startInclusive, long endInclusive) {
		return (endInclusive - startInclusive + 1) * (startInclusive + endInclusive) / 2;
	}
}

// 100000000 200020000 54345
// answer: 10001

import java.util.*;
import java.io.*;

public class B760{
	public static void main(String[] args) throws Exception {
		in.init(System.in);
		long n=in.nextLong();//beds
		long m=in.nextLong();//pillow
		long k=in.nextLong();//bed no
		if(n==m){System.out.println(1);}
		else if(n==1){
			System.out.println(m);
		}
		else{
			long ans=2;
			long left=k-1;
			long right=n-k;
			m-=n;
			m--;
			while(m>0)
			{	ans++;
				long temp=ans-2;
				if(left-temp>=0){
					if(right-temp>=0)
					{
						m=m-2*temp-1;
					}
					else{
						m=m-temp-1-right;
					}
				}
				else if(right-temp>=0)
				{
					if(left-temp>=0){
						m=m-2*temp-1;
					}
					else{
						m=m-temp-1-left;
					}
				}
				else if(left-temp<0)
				{
					if(right-temp<0)
					{
						long hi=m/n;if(hi==0){
							m-=n;
						}
						else{
						ans--;
						ans+=hi;
						m=m-n*hi;
						}

					}
					else{
						m=m-temp-1;
						m=m-left;
					}
				}
				else{
					if(left-temp<0)
					{
						long hi=m/n;if(hi==0){
							m-=n;
						}
						else{
						ans--;
						ans+=hi;
						m=m-n*hi;
						}
					}
					else{
						m=m-temp-1;
						m-=right;
					}
				}
				if(m<0)
					{ans--;}

			}
			System.out.println(ans);
		}

	}

}
class in {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Wolfgang Beyer
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        int n;
        int m;
        int k;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            m = in.nextInt();
            k = in.nextInt();

            int left = 1;
            int right = m;
            while (left <= right) {
                int mid = (left + right) / 2;
                if (pillowsNeeded(mid) > m) {
                    right = mid - 1;
                } else {
                    left = mid + 1;
                }
            }
            out.println(right);
        }

        public long pillowsNeeded(long x) {
            //System.out.println("testing " + x);
            if (x == 1) return n;
            long result = n + x - 1;
            if (k + 1 >= x) {
                result += ((x - 2) * (x - 1)) / 2;
                //System.out.println("full left " + (((x - 2) * (x - 1)) / 2));
            } else {
                result += ((k - 1) * (2 * x - 2 - k)) / 2;
                //System.out.println("partial left" + (((k - 1) * (2 * x - 3 - k)) / 2));
            }
            if (n - k >= x - 2) {
                result += ((x - 2) * (x - 1)) / 2;
                //System.out.println();
            } else {
                result += ((n - k) * (2 * x - 3 - n + k)) / 2;
                //System.out.println("partial right " +(((n - k) * (2 * x - 4 - n + k)) / 2));
            }
            //System.out.println("result " + result);
            return result;

        }

    }

    static class InputReader {
        private static BufferedReader in;
        private static StringTokenizer tok;

        public InputReader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            try {
                while (tok == null || !tok.hasMoreTokens()) {
                    tok = new StringTokenizer(in.readLine());
                }
            } catch (IOException ex) {
                System.err.println("An IOException was caught :" + ex.getMessage());
            }
            return tok.nextToken();
        }

    }
}

import java.util.Scanner;

public class Frodo {
	static long pillows, pos, len;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		len = in.nextLong();
		pillows = in.nextLong();
		pos = in.nextLong();

		System.out.println(binSearch(0L, 1L << 30));
		// check(4);
	}

	//
	static boolean check(long mid) {
		long total = 0L;
		long k = pos - 1;
		if (mid - 1 < k) {
			total += mid * (mid - 1) / 2 + k - (mid - 1);
		} else {
			total += ((mid - 1 + mid - k) * k) / 2;
		}
		k = len - pos;
		if (mid - 1 < k) {
			total += mid * (mid - 1) / 2 + k - (mid - 1);
		} else {
			total += ((mid - 1 + mid - k) * k) / 2;
		}
		return pillows >= total + mid;
	}

	static long binSearch(long l, long r) {
		long ans = -1, mid = 0;
		while (l != r) {
			mid = (l + r) / 2;
			if (check(mid)) {
				ans = mid;
				l = mid + 1;
			} else {
				r = mid;
			}
		}
		return ans;
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	static int n,m,k;
	static long f(long x)
	{
		long ans = 0;
		long left = k-1 , right = n-k;
		if(left<x-1)
			ans += (1l*x*left) - ((1l*left*(left+1))/2);
		else
			ans += ( (1l*x*(x-1)) - ((1l*x*(x-1))/2) ) + (left - x + 1);
		if(right<x-1)
			ans += (1l*x*right) - ((1l*right*(right+1))/2);
		else
			ans += ( (1l*x*(x-1)) - ((1l*x*(x-1))/2) ) + (right - x + 1);
		return ans;
	}
	static long bs()
	{
		long lo = 1 , hi = m , ans = 1;
		while(lo<=hi)
		{
			long mid = lo + (hi-lo)/2;
			long req = f(mid);
			if(req+mid<=m)
			{
				ans = Math.max(ans, mid);
				lo = mid+1;
			}
			else
				hi = mid-1;
		}
		return ans;
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.parseInt(st.nextToken());
		m = Integer.parseInt(st.nextToken());
		k = Integer.parseInt(st.nextToken());
		System.out.println(bs());
	}
}

import java.util.*;

public class CF760B {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(); // number of bed and hobbits
		int m = in.nextInt(); // number of pillows
		int k = in.nextInt(); // where Frodo sleep. kth bed

		int result = 1;
		m -= n;

		if(m > 0)
			result ++;
		m--;

		int frodoAndNeighbors = 1;
		int range = 1;
		if(k - range > 0)
			frodoAndNeighbors++;
		if(k + range <= n)
			frodoAndNeighbors++;

		while(m >= frodoAndNeighbors){
			if(frodoAndNeighbors == n){
				result += m / n;
				break;
			} else {
				result++;
				m -= frodoAndNeighbors;

				range++;
				if(k - range > 0){
					frodoAndNeighbors++;
				}
				if(k + range <= n){
					frodoAndNeighbors++;
				}
			}
		}
		System.out.println(result);
	}
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//package pkg393b;

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        static private int n, k, m;

        private long getPiramidPillowNumber(long l) {
            return l * (l + 1) / 2;
        }

        private long howManyPillow(int l) {
            long res = 0;
            int lMargin = java.lang.Integer.min(l, k);
            int rMargin = java.lang.Integer.min(l - 1, n - k);
            res += getPiramidPillowNumber(l) +
                    getPiramidPillowNumber(l - 1);
            res -= getPiramidPillowNumber(l - lMargin) +
                    getPiramidPillowNumber(l - 1 - rMargin);
            return res;
        }

        private int howManyPillowFrodo() {
            int p = 0, q = m;
            while (p < q) {
                int mid = p + (q - p + 1) / 2;
                if (howManyPillow(mid) + n <= m) {
                    p = mid;
                } else {
                    q = mid - 1;
                }
            }
            return p;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            m = in.nextInt();
            k = in.nextInt();
            int res = howManyPillowFrodo() + 1;

            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class VCFB2{

	void solve()
	{
		long n = nl();
		long m = nl()-n;
		long k = nl();
		long l = 0, r = m;
		long a = k, b = n-k+1;
		long mid = 0;
		while(l<r)
		{
			mid = (r+l+1)/2;
			long f = mid*(mid+1)/2;
			long g = mid>a ? (mid-a)*(mid-a+1)/2 : 0;
			long h = mid>b ? (mid-b)*(mid-b+1)/2 : 0;
			long val = 2*f-g-h-mid;
			if(val>m)
				r = mid-1;
			else
				l = mid;
		}
		out.println(++l);
	}

	public static void main(String[] args){new VCFB2().start();}

	private byte[] bufferArray = new byte[1024];
	private int bufLength = 0;
	private int bufCurrent = 0;
	InputStream inputStream;
	PrintWriter out;

	void start()
	{
		inputStream = System.in;
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	int nextByte()
	{
		if(bufLength==-1)
			throw new InputMismatchException();
		if(bufCurrent>=bufLength)
		{
			bufCurrent = 0;
			try
			{bufLength = inputStream.read(bufferArray);}
			catch(IOException e)
			{ throw new InputMismatchException();}
			if(bufLength<=0)
				return -1;
		}
		return bufferArray[bufCurrent++];
	}

	boolean isSpaceChar(int x)
	{return (x<33 || x>126);}

	boolean isDigit(int x)
	{return (x>='0' && x<='9');}

	int nextNonSpace()
	{
		int x;
		while((x=nextByte())!=-1 && isSpaceChar(x));
		return x;
	}

	int ni()
	{
		int ans = 0;
		int sign = 1;
		int x = nextNonSpace();
		if(x=='-')
		{
			sign = -1;
			x = nextByte();
		}
		while(!isSpaceChar(x))
		{
			if(isDigit(x))
			{
				ans = ans*10 + x -'0';
				x = nextByte();
			}
			else
				throw new InputMismatchException();
		}
		return sign*ans;
	}

	long nl()
	{
		long ans = 0;
		long sign = 1;
		int x = nextNonSpace();
		if(x=='-')
		{
			sign = -1;
			x = nextByte();
		}
		while(!isSpaceChar(x))
		{
			if(isDigit(x))
			{
				ans = ans*10 + x -'0';
				x = nextByte();
			}
			else
				throw new InputMismatchException();
		}
		return sign*ans;
	}

	String ns()
	{
		StringBuilder sb = new StringBuilder();
		int x = nextNonSpace();
		while(!isSpaceChar(x))
		{
			sb.append((char)x);
			x = nextByte();
		}
		return sb.toString();
	}

	String nL()
	{
		StringBuilder sb = new StringBuilder();
		int x = nextNonSpace();
		while(x==32 || !isSpaceChar(x))
		{
			sb.append((char)x);
			x = nextByte();
		}
		return sb.toString();
	}

	char nc()
	{ return (char)nextNonSpace();}

	double nd()
	{ return (double)Double.parseDouble(ns()); }

	char[] ca()
	{ return ns().toCharArray();}

	char[] ca(int n)
	{
		char[] ans = new char[n];
		int p =0;
		int x = nextNonSpace();
		while(p<n)
		{
			ans[p++] = (char)x;
			x = nextByte();
		}
		return ans;
	}

	int[] ia(int n)
	{
		int[] ans = new int[n];
		for(int i=0;i<n;i++)
			ans[i]=ni();
		return ans;
	}

	long[] la(int n)
	{
		long[] ans = new long[n];
		for(int i=0;i<n;i++)
			ans[i] = nl();
		return ans;
	}

}

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    static long getMin(long s, long f) {
        if (s>=f){
            return f * (f + 1) / 2 + (s - f);
        }
        return s * (f + f - s + 1) / 2;
    }
    public static boolean checkC(long n, long m, long k,long f){
        long left = getMin(k + 1, f);
        long right = getMin(n - k, f);
        long min = left + right - f;
        if (m>=min){
            return true;
        }
        return false;
    }
    public static void main (String[]args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken()) - 1;
        long lower=0;
        long upper=m;
        if (n==1){
            System.out.println(m);
        }else {
            while (upper - lower > 1) {
                long c = (upper + lower) / 2;
                if (checkC(n, m, k, c)) {
                    lower = c;
                } else {
                    upper = c;
                }
            }
            System.out.println(lower);
        }

    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B393 {
	public static void main(String args[]) throws FileNotFoundException {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		StringBuilder sb = new StringBuilder();
		// ----------My Code----------
		int n, m, k,wtf;
		n = in.nextInt();
		m = in.nextInt();
		k = in.nextInt();

		int l = 1, r = Integer.MAX_VALUE;

		int mid;
		int ans = 0;
		while (l < r) {
			mid = l + (r - l) / 2;
			if (check(k, n, m, mid) == true) {
				ans = mid;
				l = mid + 1;

			} else {
				r = mid;
			}
		}

		out.println(ans);
		// ---------------The End------------------

		out.close();
	}

	public static boolean check(long pos, long n, long m, long key) {

		long l = pos - 1;
		long r = n - pos;
		long value = key;

		if (l >= key - 1) {
			value += ((key - 1) * (key)) / 2;
			l = l - (key - 1);
			value += l;
		} else {
			value += ((key - 1) * (key)) / 2;
			l = key - 1 - l;
			value -= (l * (l + 1)) / 2;
		}

		if (r >= key - 1) {
			value += ((key - 1) * (key)) / 2;
			r = r - (key - 1);
			value += r;
		} else {
			value += ((key - 1) * (key)) / 2;
			r = key - 1 - r;
			value -= (r * (r + 1)) / 2;
		}

		if (value <= m)
			return true;
		return false;
	}

	// ---------------Extra Methods------------------

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	public static boolean isPal(String s) {
		for (int i = 0, j = s.length() - 1; i <= j; i++, j--) {
			if (s.charAt(i) != s.charAt(j))
				return false;
		}
		return true;
	}

	public static String rev(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static int gcd(int x, int y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static long gcdExtended(long a, long b, long[] x) {

		if (a == 0) {
			x[0] = 0;
			x[1] = 1;
			return b;
		}
		long[] y = new long[2];
		long gcd = gcdExtended(b % a, a, y);

		x[0] = y[1] - (b / a) * y[0];
		x[1] = y[0];

		return gcd;
	}

	public static int abs(int a, int b) {
		return (int) Math.abs(a - b);
	}

	public static long abs(long a, long b) {
		return (long) Math.abs(a - b);
	}

	public static int max(int a, int b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static int min(int a, int b) {
		if (a > b)
			return b;
		else
			return a;
	}

	public static long max(long a, long b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static long min(long a, long b) {
		if (a > b)
			return b;
		else
			return a;
	}
	// ---------------Extra Methods------------------

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n, int f) {
			if (f == 0) {
				int[] arr = new int[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextInt();
				}
				return arr;
			} else {
				int[] arr = new int[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextInt();
				}
				return arr;
			}
		}

		public long[] nextLongArray(int n, int f) {
			if (f == 0) {
				long[] arr = new long[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextLong();
				}
				return arr;
			} else {
				long[] arr = new long[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextLong();
				}
				return arr;
			}

		}

		public double[] nextDoubleArray(int n, int f) {
			if (f == 0) {
				double[] arr = new double[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			} else {
				double[] arr = new double[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			}
		}

	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
		}

		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}

	}

}

//package codeforces;

import java.util.Scanner;
//binary search
public class B760 {

	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		long n=sc.nextLong();
		long m=sc.nextLong();
		long k=sc.nextLong();
		sc.close();
		long l=1;
		long r=m;
		long lp=0;
		long rp=0;
		long ly=k-1;
		long ry=n-k;
		long x=m;
		while(l<r) {
			x=(l+r+1)/2;
			if(ly>x-1) {
				lp=(x*(x-1))/2+ly-x+1;
			}
			else {
				lp=((2*x-ly-1)*ly)/2;
			}
			if(ry>x-1) {
				rp=(x*(x-1))/2+ry-x+1;
			}
			else {
				rp=((2*x-ry-1)*ry)/2;
			}
			if(lp+rp+x>m) {
				if(r==x) {
					break;
				}
				r=x;
			}
			else {
				l=x;
			}
		}
		System.out.println(l);

	}

}

// CodeForces Round #760 B TODO

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class FrodoPillows {

	int n,m,k;
	int maxFrodo;

	private void readData(BufferedReader bin) throws IOException {
		String s = bin.readLine();
		String []ss = s.split(" ");
		n = Integer.parseInt(ss[0]);
		m = Integer.parseInt(ss[1]);
		k = Integer.parseInt(ss[2]);
	}

	long noHurtSum(long nf, long k) {
		long np=0;

		if (nf<=0) {
			return 0;
		} else if (nf<k) {
			np = (nf*(nf+1))/2 + (k-nf);
		} else {
			np = (k*(k+1))/2 + k*(nf-k);
		}
		// System.out.printf("noHurtSum(%d,%d) = %d\n", nf,k,np);
		return np;
	}

	long nPill(long nf) {
		long np = noHurtSum(nf, k);
		np += noHurtSum(nf-1, n-k);
		return np;
	}

	int searchMaxNf(int i0, int i1) {
		if (i1-i0<2) {
			return i0;
		}
		int ii = (i0 + i1)/2;
		long np = nPill(ii);
		int mxp;
		if (np>m) {
			mxp = searchMaxNf(i0, ii);
		} else {
			mxp = searchMaxNf(ii, i1);
		}
		return mxp;
	}

	private void calculate() {
		maxFrodo = searchMaxNf(1, m+1);
	}

	void printRes() {
		System.out.println(maxFrodo);
	}

	public static void main(String[] args) throws IOException {
		// BufferedReader bin = new BufferedReader(new FileReader("cactus.in"));
		BufferedReader bin = new BufferedReader(
				new InputStreamReader(System.in));
		FrodoPillows l = new FrodoPillows();
		l.readData(bin);
		l.calculate();
		l.printRes();
	}
}

import java.util.*;

public class Frodo_and_pillows {

	public static boolean works(double n, long m, double k, double x) {

		if (x - 1 >= k) {
			m -= k / 2 * (x - k + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
			m -= k - x;
		}
		if (x - 1 >= n - k + 1) {
			m -= (n - k + 1) / 2 * (x - (n - k + 1) + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
			m -= (n - k + 1) - x;
		}
		m += x;

		// System.out.println(x + " " + m);

		return m >= 0 ? true : false;

	}

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		double n = input.nextInt();
		long m = input.nextInt();
		double k = input.nextInt();

		input.close();

		int lo = 1;
		int hi = 1000000007;

		while (lo < hi - 1) {
			int mid = (lo + hi) / 2;
			if (works(n, m, k, mid)) {
				lo = mid;
			} else {
				hi = mid;
			}
		}

		System.out.println(lo);

	}

}

//package contest760;

import java.io.*;
import java.util.*;

/**
 * Created by Brijesh on 23-01-2017.
 */
public class Main {
    static int e09$7=1000000007;
    static double e_06=0.000001;
    static long INF=1000000000000000L;
    static final String[] EMPTY_ARRAY = new String[0];
    static String d_loc="/home/brijesh/Downloads/";
    static String d_loc2="C:\\Users\\Brijesh\\Downloads\\";
    public static void main (String[] args) throws Exception {
        //BufferedReader br=new BufferedReader(new FileReader(d_loc+"A-small-attempt0.in"));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        StringBuilder sb = new StringBuilder();
        st=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        int k=Integer.parseInt(st.nextToken());
        if (m==n) System.out.println(1);
        else {
            m-=n;
            int c=1;
            int x=2;
            m-=1;
            while (m>0) {
                //System.out.println(x+" "+m);
                if (x-k+1<=1 && x-n+k<=1) {
                    c+=2;
                } else if (x-k+1<=1 || x-n+k<=1) {
                    c++;
                } else {
                    x+=(m/c);
                    System.out.println(x);
                    System.exit(0);
                }
                if (m-c>=0)
                    x++;
                m-=c;
            }
            System.out.println(x);
        }

        System.exit(0);
    }
}

//package main;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;

public class Main {

	public static int n;
	public static int m;
	public static int k;

	public static long getCount(int middle) {

		long fulls = ((long)middle * ((long)middle + 1)) / (long)2;

		int left_stairs = (middle > k ? k - 1 : middle - 1);
		int left_one = (middle > k ? 0 : k - middle);

		int right_stairs = (middle > (n - k) + 1 ? n - k : middle - 1);
		int right_one = (middle > (n - k) + 1 ? 0 : n - (k + middle) + 1);

		long t1 = (long)((middle - 1) - left_stairs);
		long q1 = (t1 * (t1 + 1)) / 2;

		long t2 = (long)((middle - 1) - right_stairs);
		long q2 = (t2 * (t2 + 1)) / 2;

		long stairs = ((fulls + fulls) - middle) - (q1 + q2);

		return stairs + (long)left_one + (long)right_one;
	}

	public static int bs() {
		int first = 1;
		int last = m;

		while(last - first > 1) {

			int middle = (first + last) / 2;

			long needed = getCount(middle);

			if(needed < m) {
				first = middle;
			} else if(needed > m){
				last = middle;
			} else {
				return middle;
			}

		}
		long needed1 = getCount(last);

		if(needed1 <= m) return last;

		return first;

	}

	public static void main(String[] args) throws Exception {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		//BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("input")));

		String[] data = reader.readLine().trim().split("\\s+");

		reader.close();

		n = Integer.parseInt(data[0]);
		m = Integer.parseInt(data[1]);
		k = Integer.parseInt(data[2]);

		System.out.println(bs());

	}

}

import java.util.Scanner;

public class Solution2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		long m = sc.nextLong();
		long k = sc.nextLong();

		long low = 1;
		long high = m-n+1;

		long ans = low;

		while( low <= high ){

			long mid  = (low + high) /2 ;

			if( canAllocate2(n,m,k,mid) ){
				low = mid+1;
				ans = mid;
			}
			else{
				high = mid-1;
			}
		}

		System.out.println(ans);

		sc.close();

	}
// 1 2 3 4
// 1 2 1 1
	private static boolean canAllocate2(long n, long m, long k, long mid) {
		m -= mid;

		long range1 = n - k;
		long range2 = k - 1;

		long allocate1 = (mid-1)* (mid)/2;
		// 5 4 3 2 1
		if( range1  > mid-1 ){
			allocate1 += (range1 - mid + 1);
		}
		else{
			long shortcoming = mid - 1 - range1;
			allocate1 -= (shortcoming* (shortcoming+1))/2;
		}

		m -= allocate1;

		if( m < 0 ) return false;

		long allocate2 = (mid-1)* (mid)/2;
		// 5 4 3 2 1
		if( range2  > mid-1 ){
			allocate2 += (range2 - mid + 1);
		}
		else{
			long shortcoming = mid - 1 - range2;
			allocate2 -= (shortcoming* (shortcoming+1))/2;
		}

		m -= allocate2;
		if( m < 0 ) return false;

		return true;

	}

	private static boolean canAllocate(long n, long m, long k, long mid) {
		// TODO Auto-generated method stub
		long reduce = mid;
		m -= reduce;

		long i = k+1;
		while( i <= n ){
			m -= Math.max(--reduce, 1);
			if( m < 0 ){
				return false;
			}
			i++;
		}

		i = k-1;
		reduce = mid;
		while( i > 0 ){
			m -= Math.max(--reduce, 1);
			if( m < 0 ){
				return false;
			}
			i--;
		}

		return true;
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Math.min;

public class ProblemB3 {
    BufferedReader rd;

    ProblemB3() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        long[] a = longarr();
        long n = a[0];
        long m = a[1];
        long k = a[2];
        out(solve(n,m,k));
    }

    private long solve(long n, long m, long k) {
        long lo = 1;
        long hi = 1100000000;
        while(hi - lo > 1) {
            long mid = (lo + hi) / 2;
            if(enough(n,m,k,mid)) {
                lo = mid;
            } else {
                hi = mid-1;
            }
        }
        long res = lo;
        for(long i=-3;i<=5;i++) {
            long x = lo + i;
            if(x >= 1) {
                if(!enough(n,m,k,x)) {
                    res = x-1;
                    break;
                }
            }
        }
        return res;
    }

    private boolean enough(long n, long m, long k, long h) {
        long rightSize = min(h,n-k+1);
        long leftSize = min(h-1,k-1);
        long covered = rightSize + leftSize;
        long right = sum(h,rightSize);
        long left = sum(h-1,leftSize);
        long all = right + left;
        if(covered < n) {
            all += n-covered;
        }
        return all <= m;
    }

    private long sum(long h, long len) {
        long rest = h - len;
        long restSize = rest * (rest+1)/2;
        long hSize = h * (h+1)/2;
        return hSize - restSize;
    }

    private long[] longarr() throws IOException {
        return longarr(rd.readLine());
    }

    private long[] longarr(String s) {
        String[] q = split(s);
        int n = q.length;
        long[] a = new long[n];
        for(int i=0;i<n;i++) {
            a[i] = Long.parseLong(q[i]);
        }
        return a;
    }

    private String[] split(String s) {
        if(s == null) {
            return new String[0];
        }
        int n = s.length();
        int start = -1;
        int end = 0;
        int sp = 0;
        boolean lastWhitespace = true;
        for(int i=0;i<n;i++) {
            char c = s.charAt(i);
            if(isWhitespace(c)) {
                lastWhitespace = true;
            } else {
                if(lastWhitespace) {
                    sp++;
                }
                if(start == -1) {
                    start = i;
                }
                end = i;
                lastWhitespace = false;
            }
        }
        if(start == -1) {
            return new String[0];
        }
        String[] res = new String[sp];
        int last = start;
        int x = 0;
        lastWhitespace = true;
        for(int i=start;i<=end;i++) {
            char c = s.charAt(i);
            boolean w = isWhitespace(c);
            if(w && !lastWhitespace) {
                res[x++] = s.substring(last,i);
            } else if(!w && lastWhitespace) {
                last = i;
            }
            lastWhitespace = w;
        }
        res[x] = s.substring(last,end+1);
        return res;
    }

    private boolean isWhitespace(char c) {
        return c==' ' || c=='\t';
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new ProblemB3();
    }
}

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		long m = sc.nextLong();
		long k = sc.nextLong();

//		long ans = 1;
//		//m = m-n;
//		long l = 0;
//		long r = 0;
//		long x = 1;

		if(n==1){
			System.out.println(m);
			return;
		}

		long ans1 = bs(0,m,m,n,k);

//		while(m>0){
//
//			ans++;
//
//			l = Math.min(x,k-1);
//			r = Math.min(x,n-k);
//			m = m-l-r-1;
//			x++;
//		}

		System.out.println(ans1);
	}

	private static long bs(long s, long e, long m, long n, long k) {

		if(s>=e) return s;

		long mid = (s+e)/2;

		long v1 = numberOfPillows(mid, n, k);
		long v2 = numberOfPillows(mid+1, n, k);

		if(m>=v1 && m<v2) return mid;

		if(v1>m) return bs(s,mid,m,n,k);
		else return bs(mid+1,e,m,n,k);

	}

	private static long numberOfPillows(long a, long n, long k) {

		long l = getNumber(a, k);
		long r = getNumber(a-1, n-k);

		return l+r;

	}

	private static long getNumber(long a, long k){

		long l = 0;

		if(a<k){
			l = a*(a+1)/2;
			l+=(k-a);
		}else{
			l = (a + (a-k+1))*(k)/2;
		}

		return l;

	}

}

import java.util.Scanner;

/**
 *
 * @author Simone Vuotto
 */
public class B {

     /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt() - n; // Every one has a pillow
        int k = scanner.nextInt();
        int frodosPillows = 1;

        int leftHobbits = k - 1;
        int rightHobbits = n - k;
        int maxItr = Math.max(leftHobbits, rightHobbits);

        int itr = 0;

        while(m > 0 && itr < maxItr) {
            ++frodosPillows;
            --m;
            m -= Math.min(itr, leftHobbits);
            m -= Math.min(itr, rightHobbits);
            ++itr;
        }

        if(m < 0)
            --frodosPillows;
        else
            frodosPillows += m / n;

        System.out.println(frodosPillows);
    }

}

import java.util.*;
public class Frodoandpillows{
	public static boolean ispossible(long n,long k, long m ,long p){
		long left=k-1;
		long right=n-k;
		long total=p;
		long copyp=p;
		//System.out.println("m, p ,left,right"+m+" "+p+" "+left+" "+right);
		for(int i=0;i<Math.min(left,right);i++) {
			if(total>m) return false;
			if(copyp==1) {
				total+=(Math.min(left,right)-i)*2;
				//System.out.println("total1 "+total+" "+copyp);
				if(total>m) return false;
				break;
			}
			else{
				copyp--;
				total+=2*copyp;
				//System.out.println("total1 "+total+" "+copyp);
			}
		}
		for(int i=0;i<Math.max(left,right)-Math.min(left,right);i++){
			if(total>m) return false;
			if(copyp==1) {
				total+=(Math.max(left,right)-Math.min(left,right)-i);
				//System.out.println("total2 "+total+" "+copyp);
				if(total>m) return false;
				break;
			}

			else{
				copyp--;
				total+=copyp;
				//System.out.println("total2 "+total+" "+copyp);
			}
		}
		if (total<=m) return true;
		return false;

	}
	public static long search(long n,long k, long m ,long p){
		long l=1;
		long h=p;
		long maxp=h;
		while (l <= h) {
        	long mid = (l + h) / 2;
        	boolean x=ispossible(n,k,m,mid);
        	//System.out.println(x);
        	if(x){
        		maxp = mid;
            	l = mid + 1;
        	}
        	else h=mid-1;
        }
        return maxp;

	}
	public static void main(String[] args){
		Scanner s= new Scanner(System.in);
		long n=s.nextLong();
		long m=s.nextLong();
		long k=s.nextLong();
		//System.out.println(ispossible(n,k,m,6103));
		System.out.println(search(n,k,m,m-n+1));
	}
}

import java.util.Scanner;

public class Main{
    public static void main(String...args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long m = sc.nextLong();
        long k = sc.nextLong()-1;
        long side = n - k - 1;
        long left = 1;
        long right = m + 1;
        long middle, sideOne, sideTwo;

        while (left < right - 1){
            middle = (left + right) / 2;
            if (k > middle - 1) sideOne = ((middle - 1) * middle) / 2 + k - middle + 1;
            else sideOne = ((middle - 1 + middle - k) * k) / 2;
            if (side > middle - 1) sideTwo = ((middle - 1) * middle) / 2 + side - middle + 1;
            else sideTwo = ((middle - 1 + middle - side) * side) / 2;
            if (m >= sideOne + sideTwo + middle) left = middle;
            else right = middle;
        } System.out.println(left); }
}

// package stupiddog;

import java.io.*;
import java.lang.*;
import java.util.*;

/**
 *
 * @author Huynh Sam Ha - BKU - VN - 1610852@hcmut.edu.vn
 * @author Stupid - Dog
 *
 */
public class StupidDog {

    public static void main(String[] args) throws IOException {
        inputSystem = new InputStreamReader(System.in);
        outputSystem = new OutputStreamWriter(System.out);
        //inputFile = new FileReader("D:/Java/File/inp.txt");
        //outputFile = new FileWriter("D:/Java/File/out.txt");

        inp = new BufferedReader(inputSystem);
        out = new PrintWriter(outputSystem);

        solve();

        inp.close();
        out.close();
    }

    static long count(long x, long T) {
        if (x > T) return x*T - T*(T+1)/2;
        return x*(x-1)/2 + T-(x-1);
    }

    static void solve() throws IOException {
        long n = nextLong();
        long m = nextLong();
        long k = nextLong();
        long l = 1, r = m, ans = 1;
        while (l <= r) {
            long x = (l+r)>>1;
            if (x + count(x,n-k)+count(x,k-1) <= m) {
                ans = x; l = x+1;
            }
            else
                r = x-1;
        }
        System.out.println(ans);
    }

    /* ---------------------------------------------------- */
    static BufferedReader inp;
    static PrintWriter out;
    static InputStreamReader inputSystem;
    static OutputStreamWriter outputSystem;
    static Reader inputFile;
    static Writer outputFile;
    static StringTokenizer token;

    /*NSt + TAB*/
    static String nextString() throws IOException {
        while (token == null || !token.hasMoreElements()) {
            token = new StringTokenizer(inp.readLine());
        }
        return token.nextToken();
    }

    /*NI + TAB*/
    static int nextInt() throws IOException {
        return Integer.parseInt(nextString());
    }

    /*NL + TAB*/
    static long nextLong() throws IOException {
        return Long.parseLong(nextString());
    }

    /*NDB + TAB*/
    static double nextDouble() throws IOException {
        return Double.parseDouble(nextString());
    }
}

/**
 *
 * TAB
 * out.println(); outln
 * out.printf(""); outf
 *
 */

import java.io.*;
import java.math.*;
import java.util.*;

public class B {
	final static int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		FastReader in = new FastReader(System.in);
		long n = in.nextInt();
		long m = in.nextInt();
		long k = in.nextInt();
		k = Math.max(k, n - k + 1);
		long state1 = n;
		long state2 = (n - k) * (n - k + 1) + k;
		long state3 = k * (k + 1) / 2 + k * (n - k) - (n - k) * (n - k + 1) / 2;
		if (m == state1) {
			System.out.println(1);
		} else if (m <= state2) {
			double a = -1;
			double b = 2 * (n - k);
			double c = m - state2;
			double delta = b * b - 4 * a * c;
			double x1 = (-b + Math.sqrt(delta)) / (2 * a);
			long q = (long) x1;
			if (x1 != (double)q)
				q++;
			System.out.println(n - k + 1 - q);
		} else if (m <= state3) {
			double a = -1;
			double b = 2 * n - 1;
			double c = 2 * (m - state3);
			double delta = b * b - 4 * a * c;
			double x1 = (-b + Math.sqrt(delta)) / (2 * a);
			long q = (long) x1;
			if (x1 != (double)q)
				q++;
			System.out.println(k - q);
		} else {
			long q = (m - state3) / n;
			System.out.println(k + q);
		}
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	static long pow(long n, long p, long m) {
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0) {
			if (p % 2 == 1)
				result *= n;
			if (result >= m)
				result %= m;
			p >>= 1;
			n *= n;
			if (n >= m)
				n %= m;
		}
		return result;
	}

	static class Pair implements Comparable<Pair> {
		long a, b;

		public Pair(long a, long b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o) {
			if (this.a != o.a)
				return Long.compare(this.a, o.a);
			else
				return Long.compare(this.b, o.b);
		}

		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode() {
			return new Long(a).hashCode() * 31 + new Long(b).hashCode();
		}

		public String toString() {
			return "(" + this.a + "," + this.b + ")";
		}
	}

	static class FastReader {
	    private boolean finished = false;

	    private InputStream stream;
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    private SpaceCharFilter filter;

	    public FastReader(InputStream stream) {
	        this.stream = stream;
	    }

	    public int read() {
	        if (numChars == -1) {
	            throw new InputMismatchException();
	        }
	        if (curChar >= numChars) {
	            curChar = 0;
	            try {
	                numChars = stream.read(buf);
	            } catch (IOException e) {
	                throw new InputMismatchException();
	            }
	            if (numChars <= 0) {
	                return -1;
	            }
	        }

	        return buf[curChar++];
	    }

	    public int peek() {
	        if (numChars == -1) {
	            return -1;
	        }
	        if (curChar >= numChars) {
	            curChar = 0;
	            try {
	                numChars = stream.read(buf);
	            } catch (IOException e) {
	                return -1;
	            }
	            if (numChars <= 0) {
	                return -1;
	            }
	        }
	        return buf[curChar];
	    }

	    public int nextInt() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        int sgn = 1;
	        if (c == '-') {
	            sgn = -1;
	            c = read();
	        }
	        int res = 0;
	        do {
	            if (c == ',') {
	                c = read();
	            }
	            if (c < '0' || c > '9') {
	                throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

	    public long nextLong() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        int sgn = 1;
	        if (c == '-') {
	            sgn = -1;
	            c = read();
	        }
	        long res = 0;
	        do {
	            if (c < '0' || c > '9') {
	                throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

	    public String nextString() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        StringBuilder res = new StringBuilder();
	        do {
	            res.appendCodePoint(c);
	            c = read();
	        } while (!isSpaceChar(c));
	        return res.toString();
	    }

	    public boolean isSpaceChar(int c) {
	        if (filter != null) {
	            return filter.isSpaceChar(c);
	        }
	        return isWhitespace(c);
	    }

	    public static boolean isWhitespace(int c) {
	        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	    }

	    private String readLine0() {
	        StringBuilder buf = new StringBuilder();
	        int c = read();
	        while (c != '\n' && c != -1) {
	            if (c != '\r') {
	                buf.appendCodePoint(c);
	            }
	            c = read();
	        }
	        return buf.toString();
	    }

	    public String nextLine() {
	        String s = readLine0();
	        while (s.trim().length() == 0)
	            s = readLine0();
	        return s;
	    }

	    public String nextLine(boolean ignoreEmptyLines) {
	        if (ignoreEmptyLines) {
	            return nextLine();
	        } else {
	            return readLine0();
	        }
	    }

	    public BigInteger nextBigInteger() {
	        try {
	            return new BigInteger(nextString());
	        } catch (NumberFormatException e) {
	            throw new InputMismatchException();
	        }
	    }

	    public char nextCharacter() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        return (char) c;
	    }

	    public double nextDouble() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        int sgn = 1;
	        if (c == '-') {
	            sgn = -1;
	            c = read();
	        }
	        double res = 0;
	        while (!isSpaceChar(c) && c != '.') {
	            if (c == 'e' || c == 'E') {
	                return res * Math.pow(10, nextInt());
	            }
	            if (c < '0' || c > '9') {
	                throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        }
	        if (c == '.') {
	            c = read();
	            double m = 1;
	            while (!isSpaceChar(c)) {
	                if (c == 'e' || c == 'E') {
	                    return res * Math.pow(10, nextInt());
	                }
	                if (c < '0' || c > '9') {
	                    throw new InputMismatchException();
	                }
	                m /= 10;
	                res += (c - '0') * m;
	                c = read();
	            }
	        }
	        return res * sgn;
	    }

	    public boolean isExhausted() {
	        int value;
	        while (isSpaceChar(value = peek()) && value != -1)
	            read();
	        return value == -1;
	    }

	    public String next() {
	        return nextString();
	    }

	    public SpaceCharFilter getFilter() {
	        return filter;
	    }

	    public void setFilter(SpaceCharFilter filter) {
	        this.filter = filter;
	    }

	    public interface SpaceCharFilter {
	        public boolean isSpaceChar(int ch);
	    }
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Test {

	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String[] data = in.readLine().split(" ");
		int n = Integer.parseInt(data[0]);
		int m = Integer.parseInt(data[1]);
		int k = Integer.parseInt(data[2]);

		int pillow = 1;
		m -= n;

		while (m > 0) {
			int left = Math.min(pillow-1, k-1);
			int right = Math.min(pillow-1, n-k);
			int value = left + right + 1;

			if (pillow-1 > k-1 && pillow-1 > n-k) {
				pillow += m/value;
				m = 0;
			}
			if (value <= m) pillow++;
			m -= value;
		}
		System.out.println(pillow);
	}

}

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 *
 */
public class TaskB {
    public static void main(String[] args) {
        InputStream inputStream;
        String str = null;
        if(str == null){
            inputStream = System.in;
        }else{
            inputStream = new ByteArrayInputStream(str.getBytes());
        }

        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(1, in, out);
        out.close();
    }

    static class Solver {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long numBeds = in.nextInt();
            long numPillows = in.nextInt();
            long frodoPos = in.nextInt();

            numPillows -= numBeds;

            long frodoPillows = 1;

            long num = 1;

            long l = Math.max(0, num-frodoPos);
            long r = Math.max(0, frodoPos+(num-1)-numBeds);
            while(num<numBeds && num*num - l*(l+1)/2 - r*(r+1)/2 <= numPillows){
                //System.out.println(l + " " + r);
                num++;
                frodoPillows++;
                l = Math.max(0, num-frodoPos);
                r = Math.max(0, frodoPos+num-numBeds-1);
            }

            num--;l--;r--;
            numPillows -= num*num - l*(l+1)/2 - r*(r+1)/2;

            frodoPillows += numPillows/numBeds;

            System.out.println(frodoPillows);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class line
{
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		int k = s.nextInt();
		int left = k-1;
		int right = n-k;
		int tleft = 0;
		int tright = 0;
		m = m- n;
		int ans = 1;
		if(n==1){
		    ans += m;
		    m=0;
		}
		while(m>0){
			ans++;
			if(tleft<left) {
				tleft++;
			}
			if(tright<right) {
				tright++;
			}
			m = m-tleft-tright-1;
		}
		System.out.println(ans);
	}
}

import java.io.*;
import java.util.*;

public class B {
	static Scanner is = new Scanner(System.in);

	public static void main(String [] args) {
		final long nHobbits = is.nextInt(), nPillows = is.nextInt(), k = is.nextInt() - 1;

		long left = 1, right = nPillows - nHobbits + 1;
		if (required(right, nHobbits, k) <= nPillows) {
			System.out.println(right);
			return;
		}
		while (right - left > 1) {
			long mid = (left + right) / 2;
			long diff = nPillows - required(mid, nHobbits, k);
			if (diff >= 0) {
				left = mid;
			} else {
				right = mid;
			}
		}

		System.out.println(left);
	}

	static long required(long frodoPillows, long nHobbits, long k) {
		final long needOnLeft = (frodoPillows > k) ?
				sequenceSum(frodoPillows - k, frodoPillows - 1) :
				sequenceSum(1, frodoPillows - 1) + k - frodoPillows + 1;
		final long nHobbitsOnRight = nHobbits - k - 1;
		final long needOnRight = (frodoPillows > nHobbitsOnRight) ?
				sequenceSum(frodoPillows - nHobbitsOnRight, frodoPillows - 1) :
				sequenceSum(1, frodoPillows - 1) + nHobbitsOnRight - frodoPillows + 1;

		return frodoPillows + needOnLeft + needOnRight;
	}

	static long sequenceSum(long startInclusive, long endInclusive) {
		return (endInclusive - startInclusive + 1) * (startInclusive + endInclusive) / 2;
	}
}

// 100000000 200020000 54345
// answer: 10001

import java.util.*;
public class ddd {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();
        long l = 1, r = m, ans = Integer.MIN_VALUE;
        while (r >= l) {
            long mid = (r + l) / 2;
            long x;
                long left= Math.min(k,mid);
                x = (mid+mid-left+1)*left/2;
                x+=k-left;
                long right= Math.min(n+1-k,mid);
                x+=(mid+mid-right+1)*right/2;
                x += n-(k+right-1);
                x -= mid;

            if (x > m) {
                r = mid - 1L;
            } else {
                ans = mid;
                l = mid + 1L;
            }

        }
        System.out.print(ans);
    }
}

import java.util.Scanner;
public class pillow {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int n= s.nextInt();
		int m = s.nextInt();
		int k = s.nextInt();
		int p = m-n;
        int i=1;
        int a=0;
        int b=0;
        int count =1;
        if(n==1){
            count+=m-1;
            p=0;
        }
		while(p>0){
            a=k-i-1;
            if(a<0){
                a=0;
            }
            b=k+i-1;
            if(b>n-1){
                b=n-1;
            }
            count++;
            p-=b-a+1;
			i++;
		}
		System.out.println(count);
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();
            long m = in.nextLong();
            long k = in.nextLong();

            long l = 1, r = m;
            long ans = 1;
            m -= n;
            while (l <= r) {
                long mid = (l + r) >> 1;
                if (calc(mid, k, n) <= m) {
                    l = mid + 1;
                    ans = mid + 1;
                } else r = mid - 1;
            }

            out.println(ans);
        }

        public long calc(long x, long k, long n) {
            long temp = x * (x + 1) / 2;
            if (x > k)
                temp -= (x - k) * (x - k + 1) / 2;
            temp += (x - 1) * x / 2;
            if (x - 1 > n - k)
                temp -= (x - (n - k) - 1) * (x - (n - k)) / 2;
            return temp;
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class FrodoAndPillows {

	public static void main(String[] args) throws IOException {

		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		String[] ss = bf.readLine().split(" ");
		int n, m, k;

		n = Integer.parseInt(ss[0]);
		m = Integer.parseInt(ss[1]);
		k = Integer.parseInt(ss[2]);

		if (n == 1) {
			System.out.println(m);
		}
		else if(n == m){
			System.out.println("1");
		}
		else {
			int left = m - n;
			int frodosPillos = 1;
			int neighbours = 1;
			while (left > 0) {
				// Distribute pillows right side
				if (k + frodosPillos <= n) {
					neighbours++;
				}

				// Distribute pillows left side
				if (k - frodosPillos >= 1) {
					neighbours++;
				}

				left = left - neighbours;
				frodosPillos++;
			}

			System.out.println(frodosPillos);
		}

	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskCF393D2B solver = new TaskCF393D2B();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskCF393D2B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int k = in.nextInt();

            int min = 1;
            int max = m - n + 1;

            int maxPossible = 0;

            while (min <= max) {
                int mid = (min + max) / 2;

                if (possible(mid, n, m, k)) {
                    maxPossible = Math.max(maxPossible, mid);
                    min = mid + 1;
                } else {
                    max = mid - 1;
                }
            }
            out.println(maxPossible);
        }

        private boolean possible(long mid, long n, long m, long k) {
            return (m >= mid + sum(mid, k) + sum(mid, n - k + 1));
        }

        private long sum(long a, long k) {
            long s = (a - 1) * a / 2;

            if (k >= a) {
                s += k - 1 - (a - 1);
            } else if (k < a) {
                s -= (a - k) * (a - k + 1) / 2;
            }
            return s;
        }

    }
}

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;
import java.math.*;

import org.omg.CORBA.Any;

public class template {

	static long n=0, m=0,k=0;
	static long min=0, s=0;
	public static void main(String[] args) throws IOException {
		Reader scn=new Reader();
		n=scn.nextLong(); m=scn.nextLong(); k=scn.nextLong();

		long lo=1, hi=m;
		long ans=0;
		while(lo<=hi){
			long mid=(lo+hi)/2;

			if(f(mid)){
				lo=mid+1;
				ans=mid;
			}

			else
				hi=mid-1;
		}

		System.out.println(ans);

	}

	private static boolean f(long x) {

		long left=k-1;
		long right=n-k;

		return (long)(x+pillows(left,x)+pillows(right,x)) <=m;
	}

	public static long pillows(long beds, long x){
		long ans=0;

		if(beds > x-1){
			ans= x*(x-1)/2 + beds-(x-1);
		}
		else
			ans= beds*(2*x-beds-1)/2;

		return ans;
	}

	// _________________________TEMPLATE_____________________________________________________________

	private static class pair implements Comparable<pair> {
		double dis;
		int  pop;

		pair(double l, int b) {
			dis = l;
			pop= b;
		}

		@Override
		public int compareTo(pair o) {

			if(this.dis-o.dis >0)
				 return 1;
			else
				return -1;
		}

	}

	public static void printarray(long[] dp1) {
		for (long i : dp1)
			System.out.print(i + " ");
		System.out.println();
	}

	public static void inputarray(long []a, int n,Reader scn) throws IOException{
		for(int i=0; i<n; i++)
			a[i]=scn.nextLong();
	}

	private static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[100000 + 1]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}

}

import java.util.*;
import java.io.*;

public class B760{
	public static void main(String[] args) throws Exception {
		in.init(System.in);
		long n=in.nextLong();//beds
		long m=in.nextLong();//pillow
		long k=in.nextLong();//bed no
		if(n==m){System.out.println(1);}
		else if(n==1){
			System.out.println(m);
		}
		else{
			long ans=2;
			long left=k-1;
			long right=n-k;
			m-=n;
			m--;
			while(m>0)
			{	ans++;
				long temp=ans-2;
				if(left-temp>=0){
					if(right-temp>=0)
					{
						m=m-2*temp-1;
					}
					else{
						m=m-temp-1-right;
					}
				}
				else if(right-temp>=0)
				{
					if(left-temp>=0){
						m=m-2*temp-1;
					}
					else{
						m=m-temp-1-left;
					}
				}
				else if(left-temp<0)
				{
					if(right-temp<0)
					{
						long hi=m/n;if(hi==0){
							m-=n;
						}
						else{
						ans--;
						ans+=hi;
						m=m-n*hi;
						}

					}
					else{
						m=m-temp-1;
						m=m-left;
					}
				}
				else{
					if(left-temp<0)
					{
						long hi=m/n;if(hi==0){
							m-=n;
						}
						else{
						ans--;
						ans+=hi;
						m=m-n*hi;
						}
					}
					else{
						m=m-temp-1;
						m-=right;
					}
				}
				if(m<0)
					{ans--;}

			}
			System.out.println(ans);
		}

	}

}
class in {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}

import java.util.Scanner;

public class Frodo {
	static long pillows, pos, len;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		len = in.nextLong();
		pillows = in.nextLong();
		pos = in.nextLong();

		System.out.println(binSearch(0L, 1L << 30));
		// check(4);
	}

	//
	static boolean check(long mid) {
		long total = 0L;
		long k = pos - 1;
		if (mid - 1 < k) {
			total += mid * (mid - 1) / 2 + k - (mid - 1);
		} else {
			total += ((mid - 1 + mid - k) * k) / 2;
		}
		k = len - pos;
		if (mid - 1 < k) {
			total += mid * (mid - 1) / 2 + k - (mid - 1);
		} else {
			total += ((mid - 1 + mid - k) * k) / 2;
		}
		return pillows >= total + mid;
	}

	static long binSearch(long l, long r) {
		long ans = -1, mid = 0;
		while (l != r) {
			mid = (l + r) / 2;
			if (check(mid)) {
				ans = mid;
				l = mid + 1;
			} else {
				r = mid;
			}
		}
		return ans;
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken()) - 1;
        int l = (m + n - 1) / n, u = m + 1;
        while (u - l > 1) {
            int mid = (l + u) / 2;
            if (check(n, m, k, mid))
                l = mid;
            else
                u = mid;
        }
        System.out.println(l);
    }
    public static boolean check(int n, int m, int k, int mid) {
        long leftmid = getMin(k + 1, mid);
        long rightmid = getMin(n - k, mid);
        long min = leftmid + rightmid - mid;
        return m >= min;
    }

    static long getMin(long s, long x) {
        return s >= x ? x * (x + 1) / 2 + (s - x) : s * (x + x - s + 1) / 2;
    }
}

import java.util.*;

/**
 * Created by Luis Ngo on 4/1/2017.
 */
public class PB {
    public static void main(String args[]) {

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m =  scanner.nextInt();
        int k =  scanner.nextInt()-1;
        int remainPillow = m-n;

        int prodoPillow = 1;
        int left = 0;
        int right = 0;
        int maxLeft = k;
        int maxRight = n-1 - k;
        while(left+right+1 <= remainPillow){
            if(left == maxLeft && right==maxRight){
                int t = left + right +1;
                prodoPillow += remainPillow/t;
                break;
            }
            prodoPillow++;
            remainPillow = remainPillow - left-right-1;
            if(left<maxLeft){
                left++;
            }
            if(right<maxRight){
                right++;
            }
        }
        System.out.println(prodoPillow);
    }
}

//package main;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;

public class Main {

	public static int n;
	public static int m;
	public static int k;

	public static long getCount(int middle) {

		long fulls = ((long)middle * ((long)middle + 1)) / (long)2;

		int left_stairs = (middle > k ? k - 1 : middle - 1);
		int left_one = (middle > k ? 0 : k - middle);

		int right_stairs = (middle > (n - k) + 1 ? n - k : middle - 1);
		int right_one = (middle > (n - k) + 1 ? 0 : n - (k + middle) + 1);

		long t1 = (long)((middle - 1) - left_stairs);
		long q1 = (t1 * (t1 + 1)) / 2;

		long t2 = (long)((middle - 1) - right_stairs);
		long q2 = (t2 * (t2 + 1)) / 2;

		long stairs = ((fulls + fulls) - middle) - (q1 + q2);

		return stairs + (long)left_one + (long)right_one;
	}

	public static int bs() {
		int first = 1;
		int last = m;

		while(last - first > 1) {

			int middle = (first + last) / 2;

			long needed = getCount(middle);

			if(needed < m) {
				first = middle;
			} else if(needed > m){
				last = middle;
			} else {
				return middle;
			}

		}
		long needed1 = getCount(last);

		if(needed1 <= m) return last;

		return first;

	}

	public static void main(String[] args) throws Exception {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		//BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("input")));

		String[] data = reader.readLine().trim().split("\\s+");

		reader.close();

		n = Integer.parseInt(data[0]);
		m = Integer.parseInt(data[1]);
		k = Integer.parseInt(data[2]);

		System.out.println(bs());

	}

}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B393 {
	public static void main(String args[]) throws FileNotFoundException {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		StringBuilder sb = new StringBuilder();
		// ----------My Code----------
		int n, m, k,xyz=0;
		n = in.nextInt();
		m = in.nextInt();
		k = in.nextInt();

		int l = 1, r = Integer.MAX_VALUE;

		int mid;
		int ans = 0;
		while (l < r) {
			mid = l + (r - l) / 2;
			if (check(k, n, m, mid) == true) {
				ans = mid;
				l = mid + 1;

			} else {
				r = mid;
			}
		}

		out.println(ans);
		// ---------------The End------------------

		out.close();
	}

	public static boolean check(long pos, long n, long m, long key) {

		long l = pos - 1;
		long r = n - pos;
		long value = key;

		if (l >= key - 1) {
			value += ((key - 1) * (key)) / 2;
			l = l - (key - 1);
			value += l;
		} else {
			value += ((key - 1) * (key)) / 2;
			l = key - 1 - l;
			value -= (l * (l + 1)) / 2;
		}

		if (r >= key - 1) {
			value += ((key - 1) * (key)) / 2;
			r = r - (key - 1);
			value += r;
		} else {
			value += ((key - 1) * (key)) / 2;
			r = key - 1 - r;
			value -= (r * (r + 1)) / 2;
		}

		if (value <= m)
			return true;
		return false;
	}

	// ---------------Extra Methods------------------

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	public static boolean isPal(String s) {
		for (int i = 0, j = s.length() - 1; i <= j; i++, j--) {
			if (s.charAt(i) != s.charAt(j))
				return false;
		}
		return true;
	}

	public static String rev(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static int gcd(int x, int y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static long gcdExtended(long a, long b, long[] x) {

		if (a == 0) {
			x[0] = 0;
			x[1] = 1;
			return b;
		}
		long[] y = new long[2];
		long gcd = gcdExtended(b % a, a, y);

		x[0] = y[1] - (b / a) * y[0];
		x[1] = y[0];

		return gcd;
	}

	public static int abs(int a, int b) {
		return (int) Math.abs(a - b);
	}

	public static long abs(long a, long b) {
		return (long) Math.abs(a - b);
	}

	public static int max(int a, int b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static int min(int a, int b) {
		if (a > b)
			return b;
		else
			return a;
	}

	public static long max(long a, long b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static long min(long a, long b) {
		if (a > b)
			return b;
		else
			return a;
	}
	// ---------------Extra Methods------------------

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n, int f) {
			if (f == 0) {
				int[] arr = new int[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextInt();
				}
				return arr;
			} else {
				int[] arr = new int[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextInt();
				}
				return arr;
			}
		}

		public long[] nextLongArray(int n, int f) {
			if (f == 0) {
				long[] arr = new long[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextLong();
				}
				return arr;
			} else {
				long[] arr = new long[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextLong();
				}
				return arr;
			}

		}

		public double[] nextDoubleArray(int n, int f) {
			if (f == 0) {
				double[] arr = new double[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			} else {
				double[] arr = new double[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			}
		}

	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
		}

		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}

	}

}

import java.util.Scanner;

/**
 *
 * @author IR_HAM
 */
public class FrodoAndPillows
{
    public static void main(String [] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); int m = in.nextInt(); int k = in.nextInt();
        int frodoPillows = 1; m -= n; int expansion = 1;
        while(m > 0 && expansion < n && m >= expansion)
        {
            //System.out.println(m + " " + frodoPillows + " " + expansion);
            m -= expansion;
            if(k + frodoPillows <= n)
                expansion++;
            if(k - frodoPillows > 0)
                expansion++;
            frodoPillows++;
        }
        //System.out.println(m + " " + frodoPillows + " " + expansion);
        frodoPillows += m / n;

        System.out.println(frodoPillows);
    }
}

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		long m = sc.nextLong();
		long k = sc.nextLong();

//		long ans = 1;
//		//m = m-n;
//		long l = 0;
//		long r = 0;
//		long x = 1;

		if(n==1){
			System.out.println(m);
			return;
		}

		long ans1 = bs(0,m,m,n,k);

//		while(m>0){
//
//			ans++;
//
//			l = Math.min(x,k-1);
//			r = Math.min(x,n-k);
//			m = m-l-r-1;
//			x++;
//		}

		System.out.println(ans1);
	}

	private static long bs(long s, long e, long m, long n, long k) {

		if(s>=e) return s;

		long mid = (s+e)/2;

		long v1 = numberOfPillows(mid, n, k);
		long v2 = numberOfPillows(mid+1, n, k);

		if(m>=v1 && m<v2) return mid;

		if(v1>m) return bs(s,mid,m,n,k);
		else return bs(mid+1,e,m,n,k);

	}

	private static long numberOfPillows(long a, long n, long k) {

		long l = getNumber(a, k);
		long r = getNumber(a-1, n-k);

		return l+r;

	}

	private static long getNumber(long a, long k){

		long l = 0;

		if(a<k){
			l = a*(a+1)/2;
			l+=(k-a);
		}else{
			l = (a + (a-k+1))*(k)/2;
		}

		return l;

	}

}

//Referred Professor's code
import java.io.*;
import java.util.*;

public class Frodo {
	//Referred Professor's code
	static long getMin(long s, long x) {
		return s >= x ? x * (x + 1) / 2 + (s - x) : s * (x + x - s + 1) / 2;
	}
	static boolean check(int n, int m, int k, int x) {
		long left_min = getMin(k + 1, x);
		long right_min = getMin(n - k, x);
		long min = left_min + right_min - x;
		return m >= min;
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken()) - 1;

		int low = (m + n - 1) / n, high = m + 1;

		while (high - low > 1) {
			int mid = (low + high) / 2;
			if (check(n, m, k, mid))
				low = mid;
			else
				high = mid;
		}
		System.out.println(low);
	}
}

import java.util.Scanner;

public class Frodo {

	public static void main(String[] args) {//For Codeforces' problem: Frodo and Pillows
		// TODO Auto-generated method stub

		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		int m=scanner.nextInt();
		int k=scanner.nextInt();

		int l=1;
		m-=n;
		int x=k;
		int y=k;

		while (m>=(y-x+1)){
			l++;
			m-=y-x+1;
			x--;
			if (x==0)
				x=1;
			y++;
			if (y>n)
				y=n;
			if (x==1 && y==n){
				l+=m/n;
				m=m%n;
			}
		}

		System.out.println(l);

	}

}

import java.io.*;
import java.util.*;

public class Frodo_pillows {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String[] inp = in.readLine().split("\\s+");
        long n = Long.parseLong(inp[0]);
        long m = Long.parseLong(inp[1]);
        long k = Long.parseLong(inp[2]);

        long l = 1, h = m;
        long ans = 0;
        while(l<=h){
            long mid = l+(h-l)/2;
            if(valid_distribution(mid,m,k,n)){
                l = mid+1;
                ans = mid;
            }
            else{
                h = mid-1;
            }
        }
        System.out.println(ans);
    }

    public static boolean valid_distribution(long x, long m,long k,long n){
        if(numPillows(x,k-1)+ numPillows(x,n-k) + x<=m)
            return true;
        else
            return false;
    }

    public static long numPillows(long x, long b){
        if(b>x-1){
            return (x*(x-1)/2) + (b-(x-1));
        }
        else{
            return (b*(x-1+x-b))/2 ;
        }
    }
}

//package codeforces;

import java.util.Scanner;
//binary search
public class B760 {

	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		long n=sc.nextLong();
		long m=sc.nextLong();
		long k=sc.nextLong();
		sc.close();
		long l=1;
		long r=m;
		long lp=0;
		long rp=0;
		long ly=k-1;
		long ry=n-k;
		long x=m;
		while(l<r) {
			x=(l+r+1)/2;
			if(ly>x-1) {
				lp=(x*(x-1))/2+ly-x+1;
			}
			else {
				lp=((2*x-ly-1)*ly)/2;
			}
			if(ry>x-1) {
				rp=(x*(x-1))/2+ry-x+1;
			}
			else {
				rp=((2*x-ry-1)*ry)/2;
			}
			if(lp+rp+x>m) {
				if(r==x) {
					break;
				}
				r=x;
			}
			else {
				l=x;
			}
		}
		System.out.println(l);

	}

}

import java.util.*;

public class CF760B {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(); // number of bed and hobbits
		int m = in.nextInt(); // number of pillows
		int k = in.nextInt(); // where Frodo sleep. kth bed

		int result = 1;
		m -= n;

		if(m > 0)
			result ++;
		m--;

		int frodoAndNeighbors = 1;
		int range = 1;
		if(k - range > 0)
			frodoAndNeighbors++;
		if(k + range <= n)
			frodoAndNeighbors++;

		while(m >= frodoAndNeighbors){
			if(frodoAndNeighbors == n){
				result += m / n;
				break;
			} else {
				result++;
				m -= frodoAndNeighbors;

				range++;
				if(k - range > 0){
					frodoAndNeighbors++;
				}
				if(k + range <= n){
					frodoAndNeighbors++;
				}
			}
		}
		System.out.println(result);
	}
}

// package stupiddog;

import java.io.*;
import java.lang.*;
import java.util.*;

/**
 *
 * @author Huynh Sam Ha - BKU - VN - 1610852@hcmut.edu.vn
 * @author Stupid - Dog
 *
 */
public class StupidDog {

    public static void main(String[] args) throws IOException {
        inputSystem = new InputStreamReader(System.in);
        outputSystem = new OutputStreamWriter(System.out);
        //inputFile = new FileReader("D:/Java/File/inp.txt");
        //outputFile = new FileWriter("D:/Java/File/out.txt");

        inp = new BufferedReader(inputSystem);
        out = new PrintWriter(outputSystem);

        solve();

        inp.close();
        out.close();
    }

    static long count(long x, long T) {
        if (x > T) return x*T - T*(T+1)/2;
        return x*(x-1)/2 + T-(x-1);
    }

    static void solve() throws IOException {
        long n = nextLong();
        long m = nextLong();
        long k = nextLong();
        long l = 1, r = m, ans = 1;
        while (l <= r) {
            long x = (l+r)>>1;
            if (x + count(x,n-k)+count(x,k-1) <= m) {
                ans = x; l = x+1;
            }
            else
                r = x-1;
        }
        System.out.println(ans);
    }

    /* ---------------------------------------------------- */
    static BufferedReader inp;
    static PrintWriter out;
    static InputStreamReader inputSystem;
    static OutputStreamWriter outputSystem;
    static Reader inputFile;
    static Writer outputFile;
    static StringTokenizer token;

    /*NSt + TAB*/
    static String nextString() throws IOException {
        while (token == null || !token.hasMoreElements()) {
            token = new StringTokenizer(inp.readLine());
        }
        return token.nextToken();
    }

    /*NI + TAB*/
    static int nextInt() throws IOException {
        return Integer.parseInt(nextString());
    }

    /*NL + TAB*/
    static long nextLong() throws IOException {
        return Long.parseLong(nextString());
    }

    /*NDB + TAB*/
    static double nextDouble() throws IOException {
        return Double.parseDouble(nextString());
    }
}

/**
 *
 * TAB
 * out.println(); outln
 * out.printf(""); outf
 *
 */

import java.util.*;

public class Frodo_and_pillows {

	public static boolean works(double n, long m, double k, double x) {

		if (x - 1 >= k) {
			m -= k / 2 * (x - k + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
			m -= k - x;
		}
		if (x - 1 >= n - k + 1) {
			m -= (n - k + 1) / 2 * (x - (n - k + 1) + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
			m -= (n - k + 1) - x;
		}
		m += x;

		// System.out.println(x + " " + m);

		return m >= 0 ? true : false;

	}

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		double n = input.nextInt();
		long m = input.nextInt();
		double k = input.nextInt();

		input.close();

		int lo = 1;
		int hi = 1000000007;

		while (lo < hi - 1) {
			int mid = (lo + hi) / 2;
			if (works(n, m, k, mid)) {
				lo = mid;
			} else {
				hi = mid;
			}
		}

		System.out.println(lo);

	}

}

// CodeForces Round #760 B TODO

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class FrodoPillows {

	int n,m,k;
	int maxFrodo;

	private void readData(BufferedReader bin) throws IOException {
		String s = bin.readLine();
		String []ss = s.split(" ");
		n = Integer.parseInt(ss[0]);
		m = Integer.parseInt(ss[1]);
		k = Integer.parseInt(ss[2]);
	}

	long noHurtSum(long nf, long k) {
		long np=0;

		if (nf<=0) {
			return 0;
		} else if (nf<k) {
			np = (nf*(nf+1))/2 + (k-nf);
		} else {
			np = (k*(k+1))/2 + k*(nf-k);
		}
		// System.out.printf("noHurtSum(%d,%d) = %d\n", nf,k,np);
		return np;
	}

	long nPill(long nf) {
		long np = noHurtSum(nf, k);
		np += noHurtSum(nf-1, n-k);
		return np;
	}

	int searchMaxNf(int i0, int i1) {
		if (i1-i0<2) {
			return i0;
		}
		int ii = (i0 + i1)/2;
		long np = nPill(ii);
		int mxp;
		if (np>m) {
			mxp = searchMaxNf(i0, ii);
		} else {
			mxp = searchMaxNf(ii, i1);
		}
		return mxp;
	}

	private void calculate() {
		maxFrodo = searchMaxNf(1, m+1);
	}

	void printRes() {
		System.out.println(maxFrodo);
	}

	public static void main(String[] args) throws IOException {
		// BufferedReader bin = new BufferedReader(new FileReader("cactus.in"));
		BufferedReader bin = new BufferedReader(
				new InputStreamReader(System.in));
		FrodoPillows l = new FrodoPillows();
		l.readData(bin);
		l.calculate();
		l.printRes();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B {
	static long sum[];
	static long idxx;

	public static int binarysearch(long x) {
		int low = 0;
		int high = 100000;
		int ans = -1;
		while (low <= high) {
			int mid = (high + low) / 2;
			if (sum[mid] > x)
				high = mid - 1;
			if (sum[mid] <= x) {
				low = mid + 1;
				ans = mid;
			}
		}
		return ans == -1 ? 0 : ans;

	}

	public static long binarysearch2(long m, long n, long k) {
		long low = 0;
		long high = 100000;
		long ans = -1;
		while (low <= high) {
			long mid = (high + low) / 2;
			long end = Math.max(mid - Math.min(n - k + 1, k), 0);
			long sumtaken = mid * (mid + 1) - mid - (end * (end + 1) / 2);
			if (sumtaken > m)
				high = mid - 1;
			if (sumtaken <= m) {
				low = mid + 1;
				ans = sumtaken;
				idxx = mid;
			}
		}
		return ans == -1 ? 0 : ans;

	}

	public static long ceil(long a, long b) {
		long ans = a / b;
		if (a % b != 0)
			ans++;
		return ans;
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		sum = new long[100000];
		for (int i = 1; i < 100000; i++) {
			sum[i] = ((long) i) * (i + 1) / 2;

		}
		long n = in.nextLong();
		long m = in.nextLong();
		long k = in.nextLong();
		m -= n;
		long ans = 1;
		if (k == 1 || k == n) {
			long idx = binarysearch(m);
			if (idx > n) {
				ans += n;
				m -= sum[(int) n];
				ans += m / n;
			} else
				ans += idx;
		} else {
			long maxside = Math.max(n - k + 1, k);
			long num = maxside - Math.min(n - k + 1, k);
			long sumtaken = maxside * (maxside + 1) - maxside
					- (num * (num + 1) / 2);

			if (sumtaken <= m) {
				ans += maxside;
				m -= sumtaken;
				ans += m / n;
			} else {
				idxx = 0;
				long summ = binarysearch2(m, n, k);
				ans += idxx;
				m -= summ;
				ans += m / n;
			}

		}
		System.out.println(ans);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}
	}

}

import java.util.Scanner;

public class frodoAndPillow {

	public static long solveFor(long n ,long m,long k) {
		long start=1,end=m;
		long ans=1;
		while(start<=end) {
		long middle=(start+end)/2;

		long result=totalPillows(n,m,k,middle);

		if(result>m||result==Integer.MIN_VALUE) {
			end=middle-1;

		}

		else {
			start=middle+1;
			ans=middle;
		}

		}
		return ans;
	}

	public static long totalPillows(long n,long m,long k,long possibleAnswer) {
		if(m-possibleAnswer<n-1) return Integer.MIN_VALUE;
		long rightBeds=n-k;
		long x=rightBeds>=possibleAnswer?rightBeds-(possibleAnswer-1):0;
		long r1=rightBeds-x;

		long leftBeds=k-1;
		long y=leftBeds>=possibleAnswer?leftBeds-(possibleAnswer-1):0;
		long r2=leftBeds-y;
		long rightSum=(r1*possibleAnswer)-(((r1+1)*r1)/2)+x;
		long leftSum=(r2*possibleAnswer)-(((r2+1)*r2)/2)+y;

		return  possibleAnswer+rightSum+leftSum;
	}

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		long n=scan.nextLong();
		long m=scan.nextLong();
		long k=scan.nextLong();

	System.out.print(solveFor(n,m,k));

	}

}

import java.io.*;
import java.util.*;
import java.lang.*;

public final class Main {

    private void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();

        if (n == 1){
            out.print(m);
            return;
        }

        int res = 0;
        m -= n;
        res++;
        if (m > 0){
            res++;
            m--;
        }
        boolean leftSide = false, rightSide = false;
        int add;

        if (k == 1){
            leftSide = true;
        }
        if (k == n){
            rightSide = true;
        }

        if (k != 1 && k != n){
            add = 3;
        }else{
            add = 2;
        }

        int cLeft = k - 1, cRight = k + 1;

        while (m > 0){
            m -= add;
            if (m >= 0){
                res++;
            }else{
                out.print(res);
                return;
            }

            if (!leftSide){
                if (cLeft == 1){
                    leftSide = true;
                }else{
                    cLeft--;
                }
            }
            if (!rightSide){
                if (cRight == n){
                    rightSide = true;
                }else{
                    cRight++;
                }
            }
            if (!leftSide && !rightSide) {
                add += 2;
            }else if ((leftSide && !rightSide) || (!leftSide && rightSide)){
                add += 1;
            }else{
                out.print(res + (m / add));
                return;
            }
        }

        out.print(res);
    }

    //    -------------I/O-------------    \\
    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    public static void main(String[] args) {
        new Main().runIO();
    }

    private FScanner in;
    private PrintWriter out;

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    static long getMin(long s, long f) {
        if (s>=f){
            return f * (f + 1) / 2 + (s - f);
        }
        return s * (f + f - s + 1) / 2;
    }
    public static boolean checkC(long n, long m, long k,long f){
        long left = getMin(k + 1, f);
        long right = getMin(n - k, f);
        long min = left + right - f;
        if (m>=min){
            return true;
        }
        return false;
    }
    public static void main (String[]args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken()) - 1;
        long lower=0;
        long upper=m;
        if (n==1){
            System.out.println(m);
        }else {
            while (upper - lower > 1) {
                long c = (upper + lower) / 2;
                if (checkC(n, m, k, c)) {
                    lower = c;
                } else {
                    upper = c;
                }
            }
            System.out.println(lower);
        }

    }
}

import java.util.*;

public class CF760B {
	public static void main(String[] args){

		// getting inputs
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(); // number of bed and hobbits
		int m = in.nextInt(); // number of pillows
		int k = in.nextInt(); // where Frodo sleep. kth bed

		int result = 1;
		m -= n;

		int frodoAndNeighbors = 1;
		int range = 0;

		while(m >= frodoAndNeighbors){
			if(frodoAndNeighbors == n){
				result += m / n;
				break;
			} else {
				result++;
				m -= frodoAndNeighbors;

				range++;
				if(k - range > 0)
					frodoAndNeighbors++;
				if(k + range <= n)
					frodoAndNeighbors++;
			}
		}
		System.out.println(result);
	}
}

import java.io.*;
import java.util.*;

public class Problems2 {

    public static void main(String[] args) throws IOException {
        FastScanner sc=new FastScanner(System.in);
        long n=sc.nextInt();
        long m=sc.nextInt();
        long k=sc.nextInt();
        if(m<=n){
            System.out.println(1);
            return;
        }
        m-=n;
        long f=0,l=1000000000,x;
        long left=k-1,right=n-k;
        long sl=-1,sr=-1,sum;
        long ans=-1;
        while(f<=l){
            x=(f+l)/2;
            if(left>=x-1){
                sl=(x*(x-1))/2;
            }else if(left<x-1){
                long s=x-1-left;
                s=(s*(s+1))/2;
                sl=(x*(x-1))/2;
                sl-=s;
            }
            if(right>=x-1){
                sr=(x*(x-1))/2;
            }else if(right<x-1){
                long s=x-1-right;
                s=(s*(s+1))/2;
                sr=(x*(x-1))/2;
                sr-=s;
            }
            sum=x+sl+sr;
            if(sum<=m){
                ans=x;
                f=x+1;
            }else{
                l=x-1;
            }
        }
        System.out.println(ans+1);

    }
    public static void dis(int a[]){
        StringBuilder s=new StringBuilder();
        for(int i=0;i<a.length;i++){
            s.append(a[i]);
        }
        System.out.println(s.toString());
    }

//_________________________________
    static class FastScanner {
	    BufferedReader br;
	    StringTokenizer st;

	    public FastScanner(InputStream i) {
	        br = new BufferedReader(new InputStreamReader(i));
	        st = new StringTokenizer("");
	    }

	    public String next() throws IOException {
	        if(st.hasMoreTokens())
	            return st.nextToken();
	        else
	            st = new StringTokenizer(br.readLine());
	        return next();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    //#
	    public long nextLong() throws IOException {
	        return Long.parseLong(next());
	    }
	    public double nextDouble() throws IOException {
	        return Double.parseDouble(next());
	    }
	    //$
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();
            long m = in.nextLong();
            long k = in.nextLong();

            long l = 1, r = m;
            long ans = 1;
            m -= n;
            while (l <= r) {
                long mid = (l + r) >> 1;
                if (calc(mid, k, n) <= m) {
                    l = mid + 1;
                    ans = mid + 1;
                } else r = mid - 1;
            }

            out.println(ans);
        }

        public long calc(long x, long k, long n) {
            long temp = x * (x + 1) / 2;
            if (x > k)
                temp -= (x - k) * (x - k + 1) / 2;
            temp += (x - 1) * x / 2;
            if (x - 1 > n - k)
                temp -= (x - (n - k) - 1) * (x - (n - k)) / 2;
            return temp;
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B395 {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        solve(1, in, out);

        out.close();
    }

    private static void solve(int n, InputReader in, PrintWriter out) {
        while (n > 0) {
            solve(in, out);
            n--;
        }
    }

    private static void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        m = m - n;
        int count = 1;
        int left = k;
        int right = k;
        while (m > 0) {
            if(left==1 && right ==n){
                count += m/(right - left + 1);
                System.out.println(count);
                return;
            }
            m = m - (right - left +1);
            if(m >= 0){
                count++;
            }
            if (left > 1) {
                left--;
            }
            if(right < n){
                right++;
            }
        }
        System.out.println(count);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main31 {

	public static void main(String[] args) throws IOException
	{
		BufferedReader in;
		File file = new File("in");
		StringBuilder out = new StringBuilder("");
		if (file.exists()) {
			in = new BufferedReader(new FileReader(file));
		} else {
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		String lines[];
		int n, m, k;
		lines = in.readLine().split("\\s+");
		n = Integer.parseInt(lines[0]);
		m = Integer.parseInt(lines[1]);
		k = Integer.parseInt(lines[2]);
		long s = m-n;
		long result = 1;
		long left = k -1 ;
		long right = n - k;
		long min = Math.min(left, right);
		long max = Math.max(left, right);
		long sum = 1;
		long q;
		if ( s != 0 )
		{
			result = 2;
			s--;

			for( int i = 1; true; i++ )
			{
				if ( i <= min )
				{
					q = 2l;
				}
				else if ( i <= max )
				{
					q = 1l;
				}
				else
				{
					q = 0;
				}
				if ( q == 0)
				{
					result += s/n;
					break;
				}
				sum += q;
				if ( s - sum < 0)
				{
					break;
				}
				else
				{
					result++;
					s = s-sum;
				}
			}
		}
		System.out.println(result);
	}

	public static int[] readInts(String line)
	{
		String lines[] = line.split("\\s+");
		int result[] = new int[lines.length];
		for( int i = 0; i < lines.length ; i++ )
		{
			result[i] = Integer.parseInt(lines[i]);
		}
		return result;
	}
}

import java.util.Scanner;

public class Main{
    public static void main(String...args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long m = sc.nextLong();
        long k = sc.nextLong()-1;
        long side = n - k - 1;
        long left = 1;
        long right = m + 1;
        long middle, sideOne, sideTwo;

        while (left < right - 1){
            middle = (left + right) / 2;
            if (k > middle - 1) sideOne = ((middle - 1) * middle) / 2 + k - middle + 1;
            else sideOne = ((middle - 1 + middle - k) * k) / 2;
            if (side > middle - 1) sideTwo = ((middle - 1) * middle) / 2 + side - middle + 1;
            else sideTwo = ((middle - 1 + middle - side) * side) / 2;
            if (m >= sideOne + sideTwo + middle) left = middle;
            else right = middle;
        } System.out.println(left); }
}

import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.*;

/**
 * Created by vishakha on 07-11-2016.
 */
public class Problem {
    public static FastReader sc = new FastReader(System.in);

    public static void main(String[] args) {
        int hobbits = sc.nextInt();
        int pillows = sc.nextInt();
        int frodo = sc.nextInt();
        int right = hobbits - frodo;
        int left = frodo - 1;
//        System.out.println(minToEach);
        pillows = pillows - hobbits;
//        System.out.println(pillows);
        System.out.println(1 + binarySearch(left, right, pillows));
    }

    private static int binarySearch(int left, int right, int p) {
        int lo = 0, hi = p;
        int mid = (lo + hi) / 2;
        while (hi >= lo) {
            mid = (lo + hi) / 2;
            boolean b = check(mid, left, right, p);
            if (b) {
                lo = mid + 1;
            } else {
                hi = mid - 1;
            }
        }
        if (check(mid, left, right, p)) {
            return mid;
        }
        return mid - 1;
    }

    private static boolean check(int x, int left, int right, int p) {
        long rightMost = Math.min(x - 1, right);
        long leftMost = Math.min(x - 1, left);
        long sum = (leftMost + rightMost + 1) * x - (rightMost * (rightMost + 1)) / 2 - (leftMost * (leftMost + 1)) / 2;
        if (sum <= p) {
            return true;
        }
        return false;
    }
}

class FastReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public FastReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }

        return buf[curChar++];
    }

    public int peek() {
        if (numChars == -1) {
            return -1;
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar];
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c == ',') {
                c = read();
            }
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null) {
            return filter.isSpaceChar(c);
        }
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
        StringBuilder buf = new StringBuilder();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r') {
                buf.appendCodePoint(c);
            }
            c = read();
        }
        return buf.toString();
    }

    public String nextLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String nextLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines) {
            return nextLine();
        } else {
            return readLine0();
        }
    }

    public BigInteger nextBigInteger() {
        try {
            return new BigInteger(nextString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public char nextCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public double nextDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E') {
                return res * Math.pow(10, nextInt());
            }
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, nextInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return nextString();
    }

    public SpaceCharFilter getFilter() {
        return filter;
    }

    public void setFilter(SpaceCharFilter filter) {
        this.filter = filter;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

    public void flush() {
        writer.flush();
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class R393Div2B {
	static long n,m,k;
	public static void main(String[] args) {
		FastScanner in=new FastScanner();
		n=in.nextLong();
		m=in.nextLong();
		k=in.nextLong();

		long lo=1,hi=m;
		while(lo<hi){
			long mid=lo+(hi-lo)/2+1;
			if(isLessThanM(mid)<=m)
				lo=mid;
			else
				hi=mid-1;
		}
		if(isLessThanM(lo)<=m){
			System.out.println(lo);
		}else{
			System.out.println(lo-1);
		}
	}
	static long isLessThanM(long mid){
		long minm;
		if(k==1||k==n){
			minm=mid>n?sum(mid)-sum(mid-n):sum(mid)+n-mid;
		}else{
			long L=k-1;
			long R=n-k;
			minm=mid>L?sum(mid-1)-sum(mid-1-L):sum(mid-1)+L-mid+1;
			minm+=mid>R?sum(mid-1)-sum(mid-1-R):sum(mid-1)+R-mid+1;
			minm+=mid;
		}
		return minm;
	}
	static long sum(long a){
		return a*(a+1)/2;
	}
	static class FastScanner{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(){br=new BufferedReader(new InputStreamReader(System.in));}
		String nextToken(){
			while(st==null||!st.hasMoreElements())
				try{st=new StringTokenizer(br.readLine());}catch(Exception e){}
			return st.nextToken();
		}
		int nextInt(){return Integer.parseInt(nextToken());}
		long nextLong(){return Long.parseLong(nextToken());}
		double nextDouble(){return Double.parseDouble(nextToken());}
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
	public static long mod= (long) (1e9 +7);
	public static void main(String args[]) throws IOException
	{
		InputReader s= new InputReader(System.in);
		OutputStream outputStream= System.out;
		PrintWriter out= new PrintWriter(outputStream);
		int n= s.nextInt();
		int m= s.nextInt();
		int k= s.nextInt();
		long low=1,high=m;
		while(low<=high){
			long mid= (low+high)/2;
			long right= n-k;
			long left = k-1;
			long end= mid-1;
			long lower_right=0,lower_left=0;//upper_right=0,upper_left=0;
			if(right>0){
				long start_right= end - (right - 1);
				if(start_right<=0){
					long temp= end*(end+1)/2;
					temp+=(right-end);
					lower_right=temp;
				}
				else{
					lower_right = ((end+start_right)*right)/2;
				}
				//upper_right = right*mid;
			}
			if(left>0){
				long start_left= end - (left - 1);
				if(start_left<=0){
					long temp= end*(end+1)/2;
					temp+=(left-end);
					lower_left=temp;
				}
				else{
					lower_left = ((end+start_left)*left)/2;
				}
				//upper_left = left*mid;
			}
			if((m-mid)>= lower_left+lower_right)
				low = mid+1;
			else
				high = mid-1;
		}
		out.println(high);
		out.close();
	}

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static long modulo(long x,long y,long p)
	{
		 long res = 1;
		 x = x % p;

	    while (y > 0)
	    {
	        if (y%2==1)
	            res = (res*x) % p;

	        y = y>>1;
	        x = (x*x) % p;
	    }
	    return res;
	}

	static void catalan_numbers(int n) {
		long catalan[]= new long[n+1];
	    catalan[1] = 1;
	    for (int i = 2; i <= n; i++) {
	        for (int j = 1; j <= i - 1; j++) {
	            catalan[i] = catalan[i] + ((catalan[j]) * catalan[i - j]);
	        }
	    }
	}

	static HashSet<Integer> primeFactors(int n)   // O(sqrt(n))
	{
	    // Print the number of 2s that divide n
		HashSet<Integer> arr= new HashSet<>();
	    while (n%2 == 0)
	    {
	        arr.add(2);
	        n = n/2;
	    }

	    // n must be odd at this point.  So we can skip one element (Note i = i +2)
	    for (int i = 3; i <= Math.sqrt(n); i = i+2)
	    {
	        // While i divides n, print i and divide n
	        while (n%i == 0)
	        {
	            arr.add(i);
	            n = n/i;
	        }
	    }
	    // This condition is to handle the case when n is a prime number
	    // greater than 2
	    if (n > 2)
	        arr.add(n);

	    return arr;
	}

	public static long expo(long a, long b){
		if (b==0)
	        return 1;
	    if (b==1)
	        return a;
	    if (b==2)
	        return a*a;

	    if (b%2==0){
	            return expo(expo(a,b/2),2);
	    }
	    else{
	        return a*expo(expo(a,(b-1)/2),2);
	    }
	}
	static class Pair implements Comparable<Pair>
	{
		int f;
		int s;
		int t;
		Pair(int ii, int cc, int dd)
		{
			f=ii;
			s=cc;
			t=dd;
		}

		public int compareTo(Pair o)
		{
			return Integer.compare(this.f, o.f);
		}

	}

	public static int[] sieve(int N){    // O(n*log(logn))
		int arr[]= new int[N+1];
		for(int i=2;i<=Math.sqrt(N);i++){
			if(arr[i]==0){
				for(int j= i*i;j<= N;j= j+i){
					arr[j]=1;
				}
			}
		}
		return arr;
		// All the i for which arr[i]==0 are prime numbers.
	}
	static long gcd(long a,long b){       // O(logn)
		if(b==0) return a;
		return gcd(b,a%b);
	}

	static final class InputReader{
        private final InputStream stream;
        private final byte[] buf=new byte[1024];
        private int curChar;
        private int Chars;
        public InputReader(InputStream stream){this.stream=stream;}
		private int read()throws IOException{
            if(curChar>=Chars){
                curChar=0;
                Chars=stream.read(buf);
                if(Chars<=0)
                    return -1;
            }
            return buf[curChar++];
        }
        public final int nextInt()throws IOException{return (int)nextLong();}
        public final long nextLong()throws IOException{
            int c=read();
            while(isSpaceChar(c)){
                c=read();
                if(c==-1) throw new IOException();
            }
            boolean negative=false;
            if(c=='-'){
                negative=true;
                c=read();
            }
            long res=0;
            do{
                if(c<'0'||c>'9')throw new InputMismatchException();
                res*=10;
                res+=(c-'0');
                c=read();
            }while(!isSpaceChar(c));
            return negative?(-res):(res);
        }
        public final int[] nextIntBrray(int size)throws IOException{
            int[] arr=new int[size];
            for(int i=0;i<size;i++)arr[i]=nextInt();
            return arr;
        }
        public final String next()throws IOException{
            int c=read();
            while(isSpaceChar(c))c=read();
            StringBuilder res=new StringBuilder();
            do{
                res.append((char)c);
                c=read();
            }while(!isSpaceChar(c));
            return res.toString();
        }
        public final String nextLine()throws IOException{
            int c=read();
            while(isSpaceChar(c))c=read();
            StringBuilder res=new StringBuilder();
            do{
                res.append((char)c);
                c=read();
            }while(c!='\n'&&c!=-1);
            return res.toString();
        }
        private boolean isSpaceChar(int c){
            return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;

public class B {
    public B() throws IOException {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

        long n = sc.nextInt();
        long m = sc.nextInt();
        long k = sc.nextInt();

        long onLeft = k-1;
        long onRight = n - k;

        long l = 1;
        long h = m;

        long p = h/2;

        while( true ){

            long p1 = numPillows(onLeft,onRight,p);
            long p2 = numPillows(onLeft,onRight,p+1);

       //    System.out.prlongln(p);

            if(m>=p1&& m<p2)
                break;

            if(m<p1){
                h=p;
                p = (l+p)/2;

            }else{
                l = p;
                p = (long) Math.ceil( ((double)(h+p))/2);

            }

        }

        System.out.println(p);

    }

    long numPillows(long onLeft, long onRight , long p){
        long pillows = 0;
        if (onLeft > p-1 && onLeft!=0){
            pillows += (p-1)*p/2 + onLeft - (p-1);
        }else{
            pillows += (2*p - 1- onLeft)*onLeft/2;
        }

        if (onRight > p-1 && onRight!=0){
            pillows += (p-1)*p/2 + onRight - (p-1);
        }else{
            pillows += (2*p - 1- onRight)*onRight/2;
        }

        pillows+=p;
        return pillows;

    }

    public static void main(String[] args) throws IOException {
        new B();
        //System.out.prlongln(Math.ceil((double)(5+6)/2));
        //System.out.prlongln(B.findMostSigBit(13));
    }
}

import java.util.Scanner;

public class Solution2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		long m = sc.nextLong();
		long k = sc.nextLong();

		long low = 1;
		long high = m-n+1;

		long ans = low;

		while( low <= high ){

			long mid  = (low + high) /2 ;

			if( canAllocate2(n,m,k,mid) ){
				low = mid+1;
				ans = mid;
			}
			else{
				high = mid-1;
			}
		}

		System.out.println(ans);

		sc.close();

	}
// 1 2 3 4
// 1 2 1 1
	private static boolean canAllocate2(long n, long m, long k, long mid) {
		m -= mid;

		long range1 = n - k;
		long range2 = k - 1;

		long allocate1 = (mid-1)* (mid)/2;
		// 5 4 3 2 1
		if( range1  > mid-1 ){
			allocate1 += (range1 - mid + 1);
		}
		else{
			long shortcoming = mid - 1 - range1;
			allocate1 -= (shortcoming* (shortcoming+1))/2;
		}

		m -= allocate1;

		if( m < 0 ) return false;

		long allocate2 = (mid-1)* (mid)/2;
		// 5 4 3 2 1
		if( range2  > mid-1 ){
			allocate2 += (range2 - mid + 1);
		}
		else{
			long shortcoming = mid - 1 - range2;
			allocate2 -= (shortcoming* (shortcoming+1))/2;
		}

		m -= allocate2;
		if( m < 0 ) return false;

		return true;

	}

	private static boolean canAllocate(long n, long m, long k, long mid) {
		// TODO Auto-generated method stub
		long reduce = mid;
		m -= reduce;

		long i = k+1;
		while( i <= n ){
			m -= Math.max(--reduce, 1);
			if( m < 0 ){
				return false;
			}
			i++;
		}

		i = k-1;
		reduce = mid;
		while( i > 0 ){
			m -= Math.max(--reduce, 1);
			if( m < 0 ){
				return false;
			}
			i--;
		}

		return true;
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyBufferedReader in = new MyBufferedReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, MyBufferedReader in, PrintWriter out) {
            int[] data = in.getALineOfInts(3);
            int n = data[0];
            int m = data[1];
            int k = data[2];

            long rem = m - n;
            long start = 0;
            long end = rem + 1;
            while (start < end) {
                long mid = (start + end) / 2;
                long atBegin = k - 1;
                long atEnd = n - k;
                long minNeeded = sum(atBegin, mid) + sum(atEnd, mid);
                if (rem < minNeeded + mid) {
                    end = mid;
                } else {
                    start = mid + 1;
                }
            }

            if (start == 0) {
                out.println(1);
            } else {
                out.println(start);
            }
        }

        private long sum(long num, long mid) {
            if (num == 0 || mid == 0) {
                return 0;
            }

            long res = num * mid - ((num * (num + 1)) / 2);
            assert res > 0;
            return res;
        }

    }

    static class MyBufferedReader {
        BufferedReader in;

        public MyBufferedReader(InputStream s) {
            this.in = new BufferedReader(new InputStreamReader(s));
        }

        public int[] getALineOfInts(int numExpected) {
            int[] res = new int[numExpected];
            StringTokenizer st = null;
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < numExpected; i++)
                res[i] = Integer.parseInt(st.nextToken());
            return res;
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author zodiacLeo
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        FastPrinter out = new FastPrinter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB
    {
        public void solve(int testNumber, FastScanner in, FastPrinter out)
        {
            int n = in.nextInt();
            int p = in.nextInt();
            int pos = in.nextInt() - 1;

            int low = 1;
            int high = p + 1;
            while (high - low > 1)
            {
                int mid = low + (high - low) / 2;
                if (check(mid, p, pos, n))
                {
                    low = mid;
                } else
                {
                    high = mid;
                }
            }
            out.println(low);
        }

        private boolean check(int Q, int all, int pos, int n)
        {
            int[] a = new int[n];
            Arrays.fill(a, 1);

            all -= n;
            a[pos] = Q - 1;
            all -= Q - 1;
            for (int i = pos - 1, q = Q - 2; i >= 0 && q > 0; i--)
            {
                a[i] = q;
                all -= q;
                q--;
            }
            for (int i = pos + 1, q = Q - 2; i < n && q > 0; i++)
            {
                a[i] = q;
                all -= q;
                q--;
            }
            return all >= 0;
        }

    }

    static class FastPrinter extends PrintWriter
    {
        public FastPrinter(OutputStream out)
        {
            super(out);
        }

        public FastPrinter(Writer out)
        {
            super(out);
        }

    }

    static class FastScanner
    {
        public BufferedReader br;
        public StringTokenizer st;

        public FastScanner(InputStream is)
        {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        public String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                String s = null;
                try
                {
                    s = br.readLine();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

    }
}

/************************	      ௳  		   ************************/
import java.util.*;
import java.util.function.LongUnaryOperator;
import java.io.*;
public class Frodoandpillows
{

	/************************ SOLUTION STARTS HERE ***********************/

	private static void solve(FastScanner s1, PrintWriter out){

		long n = s1.nextLong();
		long m = s1.nextLong();
		long k = s1.nextLong();
		LongUnaryOperator sumTill = x -> (x * (x + 1)) / 2;

		long atleast = (m / n) + (m % n == 0 ? 0 : 1);
		if(k > atleast && sumTill.applyAsLong(k) + sumTill.applyAsLong(n - k) <= m)
			out.println(k + ((m - (sumTill.applyAsLong(k) + sumTill.applyAsLong(n - k))) / n));
		else if(n - k + 1 > atleast && sumTill.applyAsLong(n - k + 1) + sumTill.applyAsLong(k - 1) <= m)
			out.println((n - k + 1) + ((m - sumTill.applyAsLong(n - k + 1) + sumTill.applyAsLong(k - 1)) / n));
		else
			out.println(atleast);
	}

	/************************ SOLUTION ENDS HERE ************************/

	/************************ TEMPLATE STARTS HERE *********************/

	public static void main(String []args) throws IOException {
		FastScanner in  = new FastScanner(System.in);
		PrintWriter out =
				new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
		solve(in, out);
		in.close();
		out.close();
	}

	static class FastScanner{
		BufferedReader reader;
		StringTokenizer st;
		FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
		String next()
		{while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
		st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
		String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
		int    nextInt()   {return Integer.parseInt(next());}
		long   nextLong()  {return Long.parseLong(next());}
		double nextDouble(){return Double.parseDouble(next());}
		char   nextChar()  {return next().charAt(0);}
		int[]  nextIntArray(int n)         {int[] a= new int[n];   int i=0;while(i<n){a[i++]=nextInt();}  return a;}
		long[] nextLongArray(int n)        {long[]a= new long[n];  int i=0;while(i<n){a[i++]=nextLong();} return a;}
		int[]  nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}
		long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}
		void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
	}

	/************************ TEMPLATE ENDS HERE ************************/
}

import java.util.*;
import java.io.*;
public class Maximus {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
           m -= n;
        int min = Math.min(n - k + 1,k);
        int cnt = 0;
        int start = 1;
        while(cnt < min && m >= start){
            ++cnt;
            m -= start;
            start = 2*cnt + 1;
        }
        --start;
        while(cnt >= min && m >= start){
            ++cnt;
            m -= start;
            ++start;
        }
        System.out.print(1 + cnt);
    }
}

import java.io.*;
import java.util.*;
import java.lang.*;

public final class Main {

    private int getNumberOfDays(int m) {
        return (int) (28 + (m + Math.floor(m / 8)) % 2 + 2 % m + 2 * Math.floor(1 / m));
    }

    private void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();

        boolean right = false, left = false;
        if (k >= n / 2){
            right = true;
        }else{
            left = true;
        }

        int res = 0;
        m -= n;
        res++;
        if (m > 0){
            res++;
        }
        boolean side = false;
        int add;
        if (k != 1 && k != n){
            add = 3;
        }else{
            side = true;
            add = 2;
        }

        int count = k;
        while (m > 0){
            m -= add;
            if (m >= 0){
                res++;
            }else{
                out.print(res);
                return;
            }
            if (count == 1){
                side = true;
            }
            if (side){
                add += 2;
            }else{
                add += 1;
            }

            if (right){
                count++;
            }else if (left){
                count--;
            }
        }

        out.print(res);
    }

    //    -------------I/O-------------    \\
    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    public static void main(String[] args) {
        new Main().runIO();
    }

    private FScanner in;
    private PrintWriter out;

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}

import java.util.Scanner;
public class pillow {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int n= s.nextInt();
		int m = s.nextInt();
		int k = s.nextInt();
		int p = m-n;
        int i=1;
        int a=0;
        int b=0;
        int count =0;
        if(n==1){
            count=m-1;
            p=0;
        }
		while(p>0){
            a=k-i-1;
            if(a<0)
                a=0;
            b=k+i-1;
            if(b>n)
                b=n-1;
            count++;
            p-=b-a+1;
			i++;
		}
		System.out.println(++count);
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class R393Div2B {
	static long n,m,k;
	public static void main(String[] args) {
		FastScanner in=new FastScanner();
		n=in.nextLong();
		m=in.nextLong();
		k=in.nextLong();

		long lo=1,hi=m;
		while(lo<hi){
			long mid=lo+(hi-lo)/2+1;
			if(isLessThanM(mid)<=m)
				lo=mid;
			else
				hi=mid-1;
		}
		if(isLessThanM(lo)<=m){
			System.out.println(lo);
		}else{
			System.out.println(lo-1);
		}
	}
	static long isLessThanM(long mid){
		long minm;
		if(k==1||k==n){
			minm=mid>n?sum(mid)-sum(mid-n):sum(mid)+n-mid;
		}else{
			long L=k-1;
			long R=n-k;
			minm=mid>L?sum(mid)-sum(mid-L):sum(mid)+L-mid;
			minm+=mid>R?sum(mid)-sum(mid-R):sum(mid)+R-mid;
		}
		return minm;
	}
	static long sum(long a){
		return a*(a+1)/2;
	}
	static class FastScanner{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(){br=new BufferedReader(new InputStreamReader(System.in));}
		String nextToken(){
			while(st==null||!st.hasMoreElements())
				try{st=new StringTokenizer(br.readLine());}catch(Exception e){}
			return st.nextToken();
		}
		int nextInt(){return Integer.parseInt(nextToken());}
		long nextLong(){return Long.parseLong(nextToken());}
		double nextDouble(){return Double.parseDouble(nextToken());}
	}
}

import java.util.*;
import java.io.*;
public class Maximus {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
           m -= n;
        int min = Math.min(n - k + 1,k);
        int cnt = 0;
        int start = 1;
        while(cnt < min && m >= start){
            start = 2*cnt + 1;
            ++cnt;
            m -= start;
        }
        //System.out.println(min + " " + cnt + " " + start + " " + m);
        if(start < n)++start;
        while(cnt >= min && m >= start && start < n){
            ++cnt;
            m -= start;
            start = Math.min(start + 1,n);
        }
        cnt += m/start;
        System.out.print(1 + cnt);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CF760B {

	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		//OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(System.out);
		int l,m,p,a,b,c;
		l=in.nextInt();
		m=in.nextInt();
		p=in.nextInt();

		a=l-p;
		b=Math.abs(2*p-l);
		c=(2*m-(a*l)-(b*(2*l-p)))/(2*l);
		out.println(a+b+c);
		//out.println(a+" "+b+" "+c);
		out.close();

}
	int sieveOfEratosthenes(int n)
    {
        // Create a boolean array "prime[0..n]" and initialize
        // all entries it as true. A value in prime[i] will
        // finally be false if i is Not a prime, else true.
        boolean prime[] = new boolean[n+1];
        for(int i=0;i<n;i++)
            prime[i] = true;

        for(int p = 2; p*p <=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if(prime[p] == true)
            {
                // Update all multiples of p
                for(int i = p*2; i <= n; i += p)
                    prime[i] = false;
            }
        }
        int c=0;
        for(int i = 2; i <= n; i++)
        {
            if(prime[i] == true)
                c++;
        }
        return c;
        // Print all prime numbers
       /* for(int i = 2; i <= n; i++)
        {
            if(prime[i] == true)
                System.out.print(i + " ");
        }*/
    }
static class Pair implements Comparable<Pair> {
	int u;
	int v;
	BigInteger bi;
	public Pair(int u, int v) {
		this.u = u;
		this.v = v;
	}

	public int hashCode() {
		int hu = (int) (u ^ (u >>> 32));
		int hv = (int) (v ^ (v >>> 32));
		return 31 * hu + hv;
	}

	public boolean equals(Object o) {
		Pair other = (Pair) o;
		return u == other.u && v == other.v;
	}

	public int compareTo(Pair other) {
		return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);
	}

	public String toString() {
		return "[u=" + u + ", v=" + v + "]";
	}
}
public static void debug(Object... o) {
	System.out.println(Arrays.deepToString(o));
}
static long modulo(long a,long b,long c) {
	long x=1;
	long y=a;
	while(b > 0){
		if(b%2 == 1){
			x=(x*y)%c;
		}
		y = (y*y)%c; // squaring the base
		b /= 2;
	}
	return  x%c;
}
public static long getClosestK(long[] a, long x) {

    int low = 0;
    int high = a.length - 1;

    while (low <= high) {
        int mid = (low + high) / 2;

        // test lower case
        if (mid == 0) {
            if (a.length == 1) {
                return a[0];
            }

            return Math.min(Math.abs(a[0] - x), Math.abs(a[1] - x)) + x;
        }

        // test upper case
        if (mid == a.length - 1) {
            return a[a.length - 1];
        }

        // test equality
        if (a[mid] == x || a[mid + 1] == x) {
            return x;
        }

        // test perfect range.
        if (a[mid] < x  && a[mid + 1] > x) {
            return Math.min(Math.abs(a[mid] - x), Math.abs(a[mid + 1] - x)) + x;
        }

        // keep searching.
        if (a[mid] < x) {
            low = mid + 1;
        } else {
            high = mid;
        }
    }

    throw new IllegalArgumentException("The array cannot be empty");
}
long factorial(long n,long M)
{
    long ans=1;
    while(n>=1)
    {
        ans=(ans*n)%M;
        n--;
    }
    return ans;
}
static long gcd(long x, long y)
{
	if(x==0)
		return y;
	if(y==0)
		return x;
	long r=0, a, b;
	a = (x > y) ? x : y; // a is greater number
	b = (x < y) ? x : y; // b is smaller number
	r = b;
	while(a % b != 0)
	{
		r = a % b;
		a = b;
		b = r;
	}
	return r;
}
static class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream inputstream) {
		reader = new BufferedReader(new InputStreamReader(inputstream));
		tokenizer = null;
	}

	public String nextLine(){
		String fullLine=null;
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				fullLine=reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			return fullLine;
		}
		return fullLine;
	}
	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyBufferedReader in = new MyBufferedReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, MyBufferedReader in, PrintWriter out) {
            int[] data = in.getALineOfInts(3);
            int n = data[0];
            int m = data[1];
            int k = data[2];

            long rem = m - n;
            long start = 0;
            long end = rem + 1;
            while (start < end) {
                long mid = (start + end) / 2;
                long atBegin = k - 1;
                long atEnd = n - k;
                long minNeeded = sum(atBegin, mid) + sum(atEnd, mid);
                if (rem < minNeeded + mid) {
                    end = mid;
                } else {
                    start = mid + 1;
                }
            }

            if (start == 0) {
                out.println(1);
            } else {
                out.println(start);
            }
        }

        private long sum(long num, long mid) {
            if (num == 0 || mid == 0) {
                return 0;
            }

            return num * mid - ((num * (num + 1)) / 2);
        }

    }

    static class MyBufferedReader {
        BufferedReader in;

        public MyBufferedReader(InputStream s) {
            this.in = new BufferedReader(new InputStreamReader(s));
        }

        public int[] getALineOfInts(int numExpected) {
            int[] res = new int[numExpected];
            StringTokenizer st = null;
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < numExpected; i++)
                res[i] = Integer.parseInt(st.nextToken());
            return res;
        }

    }
}

import java.util.*;

public class Frodo_and_pillows {

	public static boolean works(double n, long m, double k, double x) {

		if (x >= k) {
			m -= k / 2 * (x - k + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
		}
		if (x >= n - k + 1) {
			m -= (n - k + 1) / 2 * (x - (n - k + 1) + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
		}
		m += x;

		return m >= 0 ? true : false;

	}

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		double n = input.nextInt();
		long m = input.nextInt();
		double k = input.nextInt();

		input.close();

		int lo = 0;
		int hi = 100000000;

		while (lo < hi - 1) {
			int mid = (lo + hi) / 2;
			if (works(n, m, k, mid)) {
				lo = mid;
			} else {
				hi = mid;
			}
		}

		System.out.println(lo);

	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author zodiacLeo
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int n = in.nextInt();
            int m = in.nextInt();
            int k = in.nextInt();

            if (n == 1)
            {
                out.println(m);
                return;
            }

            int result = n;
            int used = n * (n + 1) / 2;
            int left = m - used;
            int nn = n - 1;
            if (left < 0)
            {
                while (left < 0)
                {
                    result -= 1;
                    left += nn;
                    nn -= 1;
                }
                out.println(result);
            } else
            {
                while (left - n > 0)
                {
                    result++;
                    left -= n;
                }
                out.println(result);
            }

        }

    }
}

import java.io.*;
import java.util.*;
import java.lang.*;

public final class Main {

    private int getNumberOfDays(int m) {
        return (int) (28 + (m + Math.floor(m / 8)) % 2 + 2 % m + 2 * Math.floor(1 / m));
    }

    private void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();

        if (n == 1){
            out.print(m);
            return;
        }

        boolean right = false, left = false;
        if (k >= n / 2){
            right = true;
        }else{
            left = true;
        }

        int res = 0;
        m -= n;
        res++;
        if (m > 0){
            res++;
            m--;
        }
        boolean side = false;
        int add;
        if (k != 1 && k != n){
            add = 3;
        }else{
            side = true;
            add = 2;
        }

        int count = 0;
        if (left){
            count = k - 1;
        }else if (right){
            count = n - k;
        }

        while (m > 0){
            m -= add;
            if (m >= 0){
                res++;
            }else{
                out.print(res);
                return;
            }

            if (!side)
                if (left){
                    if (count == 1){
                        side = true;
                    }
                }else if (right){
                    if (count == n){
                        side = true;
                    }
                }

            if (!side){
                add += 2;
            }else{
                add += 1;
            }

            if (right){
                count++;
            }else if (left){
                count--;
            }
        }

        out.print(res);
    }

    //    -------------I/O-------------    \\
    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    public static void main(String[] args) {
        new Main().runIO();
    }

    private FScanner in;
    private PrintWriter out;

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author zodiacLeo
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        FastPrinter out = new FastPrinter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB
    {
        public void solve(int testNumber, FastScanner in, FastPrinter out)
        {
            long n = in.nextInt();
            long p = in.nextInt();
            long pos = in.nextInt();
            long a = pos - 1;
            long b = n - pos;

            p -= n;
            long A = a * (a + 1);
            A /= 2;
            long B = b * (b + 1);
            B /= 2;

            long count = 1;
            if (p > 0)
            {
                count += (p + B + A) / (a + b + 1);
            }
            out.println(count);

        }

    }

    static class FastScanner
    {
        public BufferedReader br;
        public StringTokenizer st;

        public FastScanner(InputStream is)
        {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        public String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                String s = null;
                try
                {
                    s = br.readLine();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

    }

    static class FastPrinter extends PrintWriter
    {
        public FastPrinter(OutputStream out)
        {
            super(out);
        }

        public FastPrinter(Writer out)
        {
            super(out);
        }

    }
}

import java.io.*;
import java.util.*;

import javax.print.attribute.HashAttributeSet;

import java.lang.*;
import java.math.*;
import java.text.DecimalFormat;
import java.lang.reflect.Array;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.security.cert.TrustAnchor;
public class Codeforces{
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static long MOD = (long)(1e9+7);
	//static int MOD = 998244353;
	static long MOD2 = MOD*MOD;
	static FastReader sc = new FastReader();
	static int pInf = Integer.MAX_VALUE;
	static int nInf = Integer.MIN_VALUE;
	public static void main(String[] args){
		int test = 1;
		//test = sc.nextInt();
		while(test-->0)solve();
		out.flush();
		out.close();
	}
	static int n,m,k;
	static boolean good(int x) {
		int l = 0;
		int r = 0;
		if(k>x-1) {
			l = (x*(x-1))/2+k-(x-1);
		}
		else{
			l = (((2*x)-k-1)*k)/2;
		}
		if(n-k-1>x-1) {
			r = (x*(x-1))/2+(n-k-1)-(x-1);
		}
		else {
			r = (((2*x)-(n-k-1)-1)*(n-k-1))/2;
		}
		return (l+r+x)<=m;
	}
	public static void solve() {
		n = sc.nextInt();
		m = sc.nextInt();
		k = sc.nextInt()-1;
		int l = 0;
		int r = m;
		while(r-l>1) {
			int mid = l+(r-l)/2;
			if(good(mid)) {
				l = mid;
			}
			else {
				r = mid;
			}
		}
		out.println(l);
	}
	static class Node{
		ArrayList<Node> connect = new ArrayList<>();
		int comp = -1;
		public int gsize() {
			return connect.size();
		}
	}
	static long nC2(long n) {
		return add((n*(n+1))/2, 0);
	}
	public static int maxRight(int x,int[] a) {
		int l = -1;      //a[l]<=x
		int r = a.length;//a[r]>x
		while(r-l>1) {
			int m = l+(r-l)/2;
			if(a[m]<=x) {
				l = m;
			}
			else {
				r = m;
			}
		}
		return l+1;
	}
	public static int minLeft(int x,int[] a) {
		int l = -1;      //a[l]<x
		int r = a.length;//a[r]>=x
		while(r-l>1) {
			int m = l+(r-l)/2;
			if(a[m]<x) {
				l = m;
			}
			else {
				r = m;
			}
		}
		return r+1;
	}
	public static int lowerBound(int key, int[] a) {
		int s = 0;
		int e = a.length-1;
		if(e==-1) {
			return 0;
		}
		int ans = -1;
		while(s<=e) {
			int m = s+(e-s)/2;
			if(a[m]>=key) {
				ans = m;
				e = m-1;
			}
			else {
				s = m+1;
			}
		}
		return ans==-1?s:ans;
	}
	public static int upperBound(int key, int[] a) {
		int s = 0;
		int e = a.length-1;
		if(e==-1) {
			return 0;
		}
		int ans = -1;
		while(s<=e) {
			int m = s+(e-s)/2;
			if(a[m]>key) {
				ans = m;
				e = m-1;
			}
			else {
				s = m+1;
			}
		}
		return ans==-1?s:ans;
	}
	public static long c2(long n) {
		if((n&1)==0) {
			return mul(n/2, n-1);
		}
		else {
			return mul(n, (n-1)/2);
		}
	}
	public static long mul(long a, long b){
	    return ((a%MOD)*(b%MOD))%MOD;
	}
	public static long add(long a, long b){
	    return ((a%MOD)+(b%MOD))%MOD;
	}
	public static long sub(long a, long b){
	    return ((a%MOD)-(b%MOD))%MOD;
	}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Integer.lowestOneBit(i)   Equals k where k is the position of the first one in the binary
//Integer.highestOneBit(i)  Equals k where k is the position of the last one in the binary
//Integer.bitCount(i)       returns the number of one-bits
//Collections.sort(A,(p1,p2)->(int)(p2.x-p1.x)) To sort ArrayList in descending order wrt values of x.
//            Arrays.parallelSort(a,new Comparator<TPair>() {
//      		public int compare(TPair a,TPair b) {
//        			if(a.y==b.y) return a.x-b.x;
//        			return b.y-a.y;
//        		}
//        	});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//PrimeFactors
    public static ArrayList<Long> primeFactors(long n) {
        ArrayList<Long> arr = new ArrayList<>();
        if (n % 2 == 0)
            arr.add((long) 2);
        while (n % 2 == 0)
            n /= 2;
        for (long i = 3; i <= Math.sqrt(n); i += 2) {
            int flag = 0;
            while (n % i == 0) {
                n /= i;
                flag = 1;
            }
            if (flag == 1)
                arr.add(i);
        }
        if (n > 2)
            arr.add(n);
        return arr;
    }
//Pair Class
    static class Pair implements Comparable<Pair>{
		int x;
		int y;
		int len;
		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
			this.len = y-x+1;
		}
		@Override
		public int compareTo(Pair o) {
			if(this.x==o.x){
			    return (this.y-o.y);
			}
			return -1*(this.x-o.x);
		}
	}
	static class TPair implements Comparable<TPair>{
		int l;
		int r;
		long index;
		public TPair(int l, int r, long index) {
			this.l = l;
			this.r = r;
			this.index = index;
		}
		@Override
		public int compareTo(TPair o) {
			if(this.l==o.l){
			    return (this.r-o.r);
			}
			return -1*(this.l-o.l);
		}
	}
//nCr
	static long[] facts, factInvs;
	static long exp(long base, long e) {
		if (e==0) return 1;
		long half=exp(base, e/2);
		if (e%2==0) return mul(half, half);
		return mul(half, mul(half, base));
	}

	static long modInv(long x) {
		return exp(x, MOD-2);
	}

	static void precomp() {
		facts=new long[1_000_000];
		factInvs=new long[1_000_000];
		factInvs[0]=facts[0]=1;
		for (int i=1; i<facts.length; i++)
			facts[i]=mul(facts[i-1], i);
		factInvs[facts.length-1]=modInv(facts[facts.length-1]);
		for (int i=facts.length-2; i>=0; i--)
			factInvs[i]=mul(factInvs[i+1], i+1);
	}

	static long nCk(int n, int k) {
		return mul(facts[n], mul(factInvs[k], factInvs[n-k]));
	}
//Kadane's Algorithm
    static long maxSubArraySum(ArrayList<Long> a) {
    	if(a.size()==0) {
    		return 0;
    	}
    	long max_so_far = a.get(0);
    	long curr_max = a.get(0);
    	for (int i = 1; i < a.size(); i++) {
           curr_max = Math.max(a.get(i), curr_max+a.get(i));
           max_so_far = Math.max(max_so_far, curr_max);
    	}
    	return max_so_far;
    }
//Shuffle Sort
    static final Random random=new Random();
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
//Merge Sort
	static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
//Brian Kernighans Algorithm
    static long countSetBits(long n){
        if(n==0) return 0;
        return 1+countSetBits(n&(n-1));
    }
//Factorial
    static long factorial(long n){
        if(n==1) return 1;
        if(n==2) return 2;
        if(n==3) return 6;
        return n*factorial(n-1);
    }
//Euclidean Algorithm
    static long gcd(long A,long B){
        if(B==0) return A;
        return gcd(B,A%B);
    }
//Modular Exponentiation
    static long fastExpo(long x,long n){
        if(n==0) return 1;
        if((n&1)==0) return fastExpo((x*x)%MOD,n/2)%MOD;
        return ((x%MOD)*fastExpo((x*x)%MOD,(n-1)/2))%MOD;
    }
//AKS Algorithm
    static boolean isPrime(long n){
        if(n<=1) return false;
        if(n<=3) return true;
        if(n%2==0 || n%3==0) return false;
        for(int i=5;i<=Math.sqrt(n);i+=6)
            if(n%i==0 || n%(i+2)==0) return false;
        return true;
    }
//Reverse an array
    static <T> void reverse(T arr[],int l,int r){
    	Collections.reverse(Arrays.asList(arr).subList(l, r));
    }
  //Print array
    static void print1d(long arr[]) {
    	out.println(Arrays.toString(arr));
    }
    static void print2d(int arr[][]) {
    	for(int a[]: arr) out.println(Arrays.toString(a));
    }
//Sieve of eratosthenes
    static int[] findPrimes(int n){
        boolean isPrime[]=new boolean[n+1];
        ArrayList<Integer> a=new ArrayList<>();
        int result[];
        Arrays.fill(isPrime,true);
        isPrime[0]=false;
        isPrime[1]=false;
        for(int i=2;i*i<=n;++i){
            if(isPrime[i]==true){
                for(int j=i*i;j<=n;j+=i) isPrime[j]=false;
            }
        }
        for(int i=0;i<=n;i++) if(isPrime[i]==true) a.add(i);
        result=new int[a.size()];
        for(int i=0;i<a.size();i++) result[i]=a.get(i);
        return result;

    }
//Indivisual factors of all nos till n
    static ArrayList<Integer>[] indiFactors(int n){
    	ArrayList<Integer>[] A = new ArrayList[n+1];
    	for(int i = 0; i <= n; i++) {
    		A[i] = new ArrayList<>();
    	}
    	int[] sieve = new int[n+1];
    	for(int i=2;i<=n;i++) {
       		if(sieve[i]==0) {
       			for(int j=i;j<=n;j+=i) if(sieve[j]==0) {
       				//sieve[j]=i;
       				A[j].add(i);
       			}
       		}
       	}
    	return A;
    }
//Segmented Sieve
    static boolean[] segmentedSieve(long l, long r){
    	boolean[] segSieve = new boolean[(int)(r-l+1)];
    	Arrays.fill(segSieve, true);
    	int[] prePrimes = findPrimes((int)Math.sqrt(r));
    	for(int p:prePrimes) {
    		long low = (l/p)*p;
    		if(low < l) {
    			low += p;
    		}
    		if(low == p) {
    			low += p;
    		}
    		for(long j = low; j<= r; j += p) {
    			segSieve[(int) (j-l)] = false;
    		}
    	}
    	if(l==1) {
    		segSieve[0] = false;
    	}
    	return segSieve;
    }
//Euler Totent function
    static long countCoprimes(long n){
        ArrayList<Long> prime_factors=new ArrayList<>();
        long x=n,flag=0;
        while(x%2==0){
            if(flag==0) prime_factors.add(2L);
            flag=1;
            x/=2;
        }
        for(long i=3;i*i<=x;i+=2){
            flag=0;
            while(x%i==0){
                if(flag==0) prime_factors.add(i);
                flag=1;
                x/=i;
            }
        }
        if(x>2) prime_factors.add(x);
        double ans=(double)n;
        for(Long p:prime_factors){
            ans*=(1.0-(Double)1.0/p);
        }
        return (long)ans;
    }
	static long modulo = (long)1e9+7;
	public static long modinv(long x){
	    return modpow(x, modulo-2);
	}
	public static long modpow(long a, long b){
	    if(b==0){
	        return 1;
	    }
	    long x = modpow(a, b/2);
	    x = (x*x)%modulo;
	    if(b%2==1){
	        return (x*a)%modulo;
	    }
	    return x;
	}
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
}

import java.io.*;

public class Hobbit{
	public static void main(String[] args)throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String[] temp = in.readLine().split(" ");

		long n = Long.parseLong(temp[0]);
		long m = Long.parseLong(temp[1]);
		long k = Long.parseLong(temp[2]);

		long left = k - 1;
		long right = n - k;

		long l = 1;
		long h = m;
		long count;
		long save = -1;

		while(l <= h){
			long mid = (l+h)/2;
			//System.out.println(l + ", " + h + ", " + mid);

			if(left < mid - 1){
				count = (left * (2 * (mid-1) - left + 1)) / 2;
			}
			else{
				count = ((mid-1) * mid) / 2 + (left - mid + 1);
			}

			if(right < mid - 1){
				count += (right * (2 * (mid-1) - right + 1)) / 2;
			}
			else{
				count += ((mid-1) * mid) / 2 + (right - mid + 1);
			}

			if(count + mid == m){
				save = mid;
				//System.out.println("equal");
				break;
			}
			else if(count + mid > m){
				h = mid - 1;
				//System.out.println("niche aa");
			}else{
				l = mid + 1;
				//System.out.println("uper jaa");
			}
			save = mid;
		}

		System.out.println(save);
	}
}

import java.io.*;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.net.ssl.SSLContext;

public class Main
{
   static long mod=(long)(1e+9) + 7;
   static int[] sieve;
   static int ans=1;
   static ArrayList<Integer> primes;

   public static boolean check(int index,int p,int[] a,int available)
   {
	   p--;
	   if(p>available) return false;

	   int b[]=new int[a.length];
	   for(int i=0;i<b.length;i++) b[i]=a[i];

	   b[index]+=p;
	   available-=p;

	   for(int i=index-1;i>=0 && available>0;i--)
	   {
		  int need=b[i+1]-2;
		  if(need>0)
		  {
			  b[i]+=need;
			  available-=need;
		  }
	   }

	   for(int i=index+1;i<b.length && available>0;i++)
	   {
		   int need=b[i-1]-2;

		   if(need>0)
			  {
			   b[i]+=need;
			   available-=need;
			  }
	   }

	   for(int i=0;i<b.length && i!=index && available>0;i++)
       {b[i]+=1; available--;}

       if(available>0) b[index]+=1;

	   for(int i=1;i<b.length;i++) if((b[i]-b[i-1])>=2) return false;
	   ans=Math.max(ans, b[index]);
	   return true;
   }

   public static void main(String[] args) throws java.lang.Exception
   {
	     fast s = new fast();
	     PrintWriter out=new PrintWriter(System.out);
	     Scanner sc=new Scanner(System.in);
	     StringBuilder fans = new StringBuilder();

	     int n=s.nextInt();
	     int p=s.nextInt();
	     int k=s.nextInt();

	     int a[]=new int[n];
	     Arrays.fill(a, 1);
	     p-=n;

	     int l=0;
	     int r=p;

	     while(l<=r)
	     {
	    	 int mid=(l+r)>>1;

	         if(check(k-1,mid,a,p))
	        	 l=mid+1;
	         else
	        	 r=mid-1;
	     }

	     System.out.println(ans);
   }

   static class fast {
		private InputStream i;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public static boolean next_permutation(int a[])
		   {
			   int i=0,j=0;int index=-1;
			   int n=a.length;

			   for(i=0;i<n-1;i++)
				   if(a[i]<a[i+1]) index=i;

			   if(index==-1) return false;
			   i=index;

			   for(j=i+1;j<n && a[i]<a[j];j++);

			   int temp=a[i];
			   a[i]=a[j-1];
			   a[j-1]=temp;

			   for(int p=i+1,q=n-1;p<q;p++,q--)
			   {
				   temp=a[p];
				   a[p]=a[q];
				   a[q]=temp;
			   }

			   return true;
		   }

		public static void division(char ch[],int divisor)
		   {
			   int div=Character.getNumericValue(ch[0]); int mul=10;int remainder=0;
			   StringBuilder quotient=new StringBuilder("");
			   for(int i=1;i<ch.length;i++)
			   {
				   div=div*mul+Character.getNumericValue(ch[i]);
				   if(div<divisor) {quotient.append("0");continue;}
				   quotient.append(div/divisor);
				   div=div%divisor;mul=10;

			   }
			   remainder=div;
			   while(quotient.charAt(0)=='0')quotient.deleteCharAt(0);
			   System.out.println(quotient+" "+remainder);
		   }

		public static void sieve(int size)
		{
			sieve=new int[size+1];
			primes=new ArrayList<Integer>();
			sieve[1]=1;
			for(int i=2;i<=Math.sqrt(size);i++)
			{
				if(sieve[i]==0)
				 {
					for(int j=i*i;j<size;j+=i) sieve[j]=1;
				 }
			}

			for(int i=2;i<=size;i++)
			{
				if(sieve[i]==0) primes.add(i);
			}
		}
		public static long pow(long n, long b, long MOD)
		   {
		       long x=1;long y=n;
		       while(b > 0)
		       {
		           if(b%2 == 1)
		           {
		               x=x*y;
		               if(x>MOD) x=x%(MOD);
		           }
		           y = y*y;
		           if(y>MOD) y=y%(MOD);
		           b >>= 1;
		       }
		       return x;
		   }

		 public static int upper(Integer[] a,int start,int end,int key)
		 {
			   int mid=(start+end)>>1;
			   if(start==end && a[mid]<key) {return -1;}
			   if(start>end) return -1;

			   if(a[mid]>=key && (((mid-1)>=0 && a[mid-1]<key) || (mid-1)==0)) return mid;
			   else if(a[mid]== key && (mid-1)>=0 && a[mid-1]==key) return lower(a,start,mid-1,key);
			   else if(key>a[mid]) return lower(a,mid+1,end,key);
			   else return lower(a,start,mid-1,key);
		}

		 public static int lower(Integer a[],int start,int end,int key)
		 {
			   int mid=(start+end)>>1;
			   if(start==end && a[mid]>key) {return -1;}
			   if(start>end) return -1;

			   if(a[mid]<=key && (((mid+1)<a.length && a[mid+1]>key) || (mid+1)==a.length)) return mid;
			   else if(a[mid]== key && (mid+1)<a.length && a[mid+1]==key) return upper(a,mid+1,end,key);
			   else if(key>=a[mid]) return upper(a,mid+1,end,key);
			   else return upper(a,start,mid-1,key);
		}

		public int gcd(int a,int b)
		{
			if(a==0) return b;
			return gcd(b%a,a);
		}
		public fast() {
			this(System.in);
		}
		public fast(InputStream is) {
			i = is;
		}
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = i.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		public String nextString() {
     		int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}
}

import java.util.*;

public class CF760B {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(); // number of bed and hobbits
		int m = in.nextInt(); // number of pillows
		int k = in.nextInt(); // where Frodo sleep. kth bed

		int result = 1;
		m -= n;

		if(m > 0)
			result ++;

		int frodoAndNeighbors = -1;
		if(k == 1 || k == n){
			frodoAndNeighbors = 2;
		} else {
			frodoAndNeighbors = 3;
		}

		if(m >= frodoAndNeighbors){
			result++;
			m -= frodoAndNeighbors;
		}
		while(m >= n){
			result++;
			m -= n;
		}
		System.out.println(result);
	}
}

import java.util.*;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);

		int n=sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();

		int left = k-1, right = n-k,ans=1;
		int temp =  0;

		m = m-n;

		while(m>=0){

			if(temp >= left && temp>=right){
				temp += m/(temp*2+1) +1;
				break;
			}
			m-=Math.min(temp, left);
			m-=Math.min(temp, right);

			m--;
			temp++;
		}

		System.out.print(ans+temp-1);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {
	static long sum[];

	public static int binarysearch(long x) {
		int low = 0;
		int high = 100000;
		int ans = -1;
		while (low <= high) {
			int mid = (high + low) / 2;
			if (sum[mid] > x)
				high = mid - 1;
			if (sum[mid] <= x) {
				low = mid + 1;
				ans = mid;
			}
		}
		return ans == -1 ? 0 : ans;

	}

	public static long ceil(long a, long b){
		long ans = a/ b;
		if(a% b != 0)
			ans++;
		return ans;
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		sum = new long[100000];
		for (int i = 1; i < 100000; i++) {
			sum[i] = ((long) i) * (i + 1) / 2;
		}
		// System.err.println(Arrays.toString(sum));
		long n = in.nextLong();
		long m = in.nextLong();
		long k = in.nextLong();
		// long ans = m / n;
		// m -= n * ans;
		m -= n;
		long ans = 1;
		if (k == 1 || k == n) {
			long idx = binarysearch(m);
//			System.err.println(idx);
			if (idx > n) {
				ans += n;
				m -= sum[(int) n];
				ans += m / n;
			} else
				ans += idx;
		} else {
			long minside = Math.min(n - k + 1, k);
			long sumtaken = minside * (minside + 1) / 2;
			if(sumtaken * 2 - minside <= m){
				ans += minside;
//				System.err.println(11);
				m -= sumtaken * 2 - minside;
				ans += m / n;
			}else{
				ans += ceil (m  ,n);

			}

		}
		System.out.println(ans);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}
	}

}

import java.util.Scanner;

public class frodoAndPillow {

	public static int solveFor(int n ,int m,int k) {
		int start=1,end=m-n;
		int ans=-1;
		while(start<=end) {
		int middle=(start+end)/2;

		if(totalPillows(n,k,middle)>m) end=middle-1;
		else {
			start=middle+1;
			ans=middle;
		}

		}
		return ans;
	}

	public static int totalPillows(int n,int k,int possibleAnswer) {
		int rightBeds=n-k;
		int leftBeds=n-rightBeds-1;
		int rightSum=(rightBeds*possibleAnswer)-(((rightBeds+1)*rightBeds)/2);
		int leftSum=(leftBeds*possibleAnswer)-(((leftBeds+1)*leftBeds)/2);
		return  possibleAnswer+rightSum+leftSum;
	}

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int m=scan.nextInt();
		int k=scan.nextInt();
		System.out.print(solveFor(n,m,k));

	}

}

import java.util.*;

public class FrodoAndPillows {

	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int numHobbits = sc.nextInt();
		int numPillows = sc.nextInt();
		int frodoBed = sc.nextInt();

		int frodoLeft = frodoBed - 1;
		int frodoRight = numHobbits - frodoBed;

		int frodoValue = numPillows - (numHobbits - 1);
		int valueLeft = 1;
		int valueRight = 1;

		if(frodoLeft > 0)
		{
			if(frodoValue > 2)
			{
				int x = (frodoValue - 1)/(frodoLeft+1);
				int newValue = frodoValue - x*frodoLeft;

				if(newValue > valueLeft+x)
				{
					frodoValue = newValue;
					valueLeft += x;
				}
				while(frodoValue - valueLeft >= 2)
				{
					frodoValue -= 1;
					valueLeft += 1;
				}
			}
		}

		if(frodoRight > 0)
		{
			if(frodoValue > 2)
			{
				int x = (frodoValue - 1)/(frodoRight+1);
				int newValue = frodoValue - x*frodoRight;
				if(newValue > valueRight+x)
				{
					frodoValue = newValue;
					valueRight += x;
				}
				while(frodoValue - valueRight >= 2)
				{
					frodoValue -= 1;
					valueRight += 1;
				}
			}
		}

		System.out.println(frodoValue);
	}

}

import java.io.*;
import java.util.*;
import java.lang.*;

public final class Main {

    private int getNumberOfDays(int m) {
        return (int) (28 + (m + Math.floor(m / 8)) % 2 + 2 % m + 2 * Math.floor(1 / m));
    }

    private void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int z = 0;
        if (n - k > k) {
            z = k;
        } else {
            z = n - k + 1;
        }
        int sum = ((2 + (n - z - 1)) * (n - z)) / 2;
        int fr = 1 + (n - z);
        if (z != 1 && z != n) {
            sum += (fr - 1 - (z - 2)) * (z - 1) / 2;
        }
        while (fr + sum > m) {
            fr--;
            sum -= n - 1;
        }
        while (fr + sum + n <= m) {
            fr += 1;
            sum += n - 1;
        }
        out.println(fr);

    }

    //    -------------I/O-------------    \\
    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    public static void main(String[] args) {
        new Main().runIO();
    }

    private FScanner in;
    private PrintWriter out;

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}

import java.util.Scanner;

public class BV8 {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long n = scan.nextLong();
		long m = scan.nextLong();
		long k = scan.nextLong();
		if (n==1) { System.out.println(m); return; }
		if (n==2) { System.out.println(m/2); return; }
		if (n==3) {
			System.out.println(m/3 + ((n==2) ? 1 : 2));
			return;
		}

		long ans = 1;
		long layer = 0;
		m-=n;
		while (true) {
			long leftAmount = layer;
			if (k-layer <= 0) leftAmount = k-1;
			long rightAmount = layer;
			if (k+layer > n) rightAmount = n-k;
			//System.out.println(layer + " " + m + " " + leftAmount + " " + rightAmount);
			if (m - leftAmount-rightAmount-1 < 0) break;
			m -= (leftAmount+rightAmount)+1;
			ans++;
			layer++;
		}
		System.out.println(ans);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {
	static long sum[];

	public static int binarysearch(long x){
		int low=0;int high=100000;
		int ans=-1;
		while(low<=high){
			int mid=(high+low)/2;
			if(sum[mid]>x)
				high=mid-1;
			if(sum[mid]<=x){
				low=mid+1;
				ans = mid;
			}
		}
		return ans == -1? 0:ans;

	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		sum = new long[100000];
		for(int i=1;i<100000;i++){
			sum[i] = ((long)i) * (i + 1) / 2;
		}
		System.err.println(Arrays.toString(sum));
		long n = in.nextLong();
		long m = in.nextLong();
		long k = in.nextLong();
		//long ans = m / n;
		//m -= n * ans;
		m-=n;
		long ans = 1;
		if (k == 1 || k == n) {
			int idx = binarysearch(m);
			ans += idx;
		}else{
			int idx = binarysearch(m / 2);
			ans+= idx;
		}
		System.out.println(ans);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B {
	static long sum[];
	static long idxx;

	public static int binarysearch(long x) {
		int low = 0;
		int high = 100000;
		int ans = -1;
		while (low <= high) {
			int mid = (high + low) / 2;
			if (sum[mid] > x)
				high = mid - 1;
			if (sum[mid] <= x) {
				low = mid + 1;
				ans = mid;
			}
		}
		return ans == -1 ? 0 : ans;

	}

	public static long binarysearch2(long m, long n, long k) {
		long low = 0;
		long high = 100000;
		long ans = -1;
		while (low <= high) {
			long mid = (high + low) / 2;
			long end = Math.max(mid - (n - k) - 1, 0);
			long sumtaken = mid * (mid + 1) - mid - (end * (end + 1) / 2);
			if (sumtaken > m)
				high = mid - 1;
			if (sumtaken <= m) {
				low = mid + 1;
				ans = sumtaken;
				idxx = mid;
			}
		}
		return ans == -1 ? 0 : ans;

	}

	public static long ceil(long a, long b) {
		long ans = a / b;
		if (a % b != 0)
			ans++;
		return ans;
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		sum = new long[100000];
		for (int i = 1; i < 100000; i++) {
			sum[i] = ((long) i) * (i + 1) / 2;

		}
		long n = in.nextLong();
		long m = in.nextLong();
		long k = in.nextLong();
		m -= n;
		long ans = 1;
		if (k == 1 || k == n) {
			long idx = binarysearch(m);
			if (idx > n) {
				ans += n;
				m -= sum[(int) n];
				ans += m / n;
			} else
				ans += idx;
		} else {
			long maxside = Math.max(n - k + 1, k);
			long num = maxside - (n - k) - 1;
			long sumtaken = maxside * (maxside + 1) - maxside
					- (num * (num + 1) / 2);
			if (sumtaken <= m) {
				ans += maxside;
				m -= sumtaken;
				ans += m / n;
			} else {
				idxx = 0;
				long summ = binarysearch2(m, n, k);
				ans += idxx;
				m -= summ;
				ans += m / n;
			}

		}
		System.out.println(ans);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}
	}

}

import java.util.*;
import java.io.*;
import java.math.*;
import static java.lang.Math.*;

public class B implements Runnable {

  public static void main(String[] args) {
    new Thread(null, new B(), "", 1 << 28).start();
  }

  int n, m, k;

  public void run() {
    Scanner sc = new Scanner();
    n = sc.nextInt();
    m = sc.nextInt();
    k = sc.nextInt();

    long l = 0;
    long r = (int)1e9;

    long lastok = 0;
    for (int i = 0; i < 100; i++) {
      long mid = (l + r) / 2;
      if (attempt(mid)) {
        lastok = mid;
        l = mid + 1;
      } else {
        r = mid;
      }
    }

    System.out.println(lastok);
  }

  boolean attempt(long val) {
    long leftVal = max(0, val - (2 * (k - 1)));
    long rightVal = max(0, val - (2 * (n - k)));
    return sum(val) + sum(val) - (leftVal == 0 ? 0 : sum(leftVal - 1))
      - (rightVal == 0 ? 0 : sum(rightVal - 1)) - val <= m;
  }

  long sum(long v) {
    return (v * (v + 1)) / 2;
  }

  class Pair {
    final int x, y;

    Pair(int x, int y) {
      this.x = x;
      this.y = y;
    }

    @Override
    public int hashCode() {
      return 191 * (31 + x) + y;
    }

    @Override
    public boolean equals(Object o) {
      Pair other = (Pair)o;
      return x == other.x && y == other.y;
    }
  }

  class Scanner {
    BufferedReader r;
    StringTokenizer t;

    Scanner() {
      r = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
      t = null;
    }

    String next() {
      while (t == null || !t.hasMoreTokens()) {
        try {
          t = new StringTokenizer(r.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return t.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    BigInteger nextBigInteger() {
      return new BigInteger(next());
    }
  }
}

import java.util.*;

public class Frodo_and_pillows {

	public static boolean works(double n, long m, double k, double x) {

		if (x >= k) {
			m -= k / 2 * (x - k + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
		}
		if (x >= n - k + 1) {
			m -= (n - k + 1) / 2 * (x - (n - k + 1) + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
		}
		m += x;

		System.out.println(x + " " + m);

		return m >= 0 ? true : false;

	}

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		double n = input.nextInt();
		long m = input.nextInt();
		double k = input.nextInt();

		input.close();

		int lo = 0;
		int hi = 1000000100;

		while (lo < hi - 1) {
			int mid = (lo + hi) / 2;
			if (works(n, m, k, mid)) {
				lo = mid;
			} else {
				hi = mid;
			}
		}

		System.out.println(lo);

	}

}

import java.util.*;
public class Frodoandpillows{
	public static boolean ispossible(long n,long k, long m ,long p){
		long left=k-1;
		long right=n-k;
		long total=p;
		long copyp=p;
		for(int i=0;i<Math.min(left,right);i++) {
			if(copyp<=0 || total>m) return false;
			copyp--;
			total+=2*copyp;
		}
		for(int i=0;i<Math.max(left,right)-Math.min(left,right);i++){
			if(copyp<=0 || total>m) return false;
			copyp--;
			total+=copyp;
		}
		if (total<=m) return true;
		return false;

	}
	public static long search(long n,long k, long m ,long p){
		long l=1;
		long h=p;
		long maxp=h;
		while (l <= h) {
        	long mid = (l + h) / 2;
        	boolean x=ispossible(n,k,m,mid);
        	if(x){
        		maxp = mid;
            	l = mid + 1;
        	}
        	else h=mid-1;
        }
        return maxp;

	}
	public static void main(String[] args){
		Scanner s= new Scanner(System.in);
		long n=s.nextLong();
		long m=s.nextLong();
		long k=s.nextLong();
		System.out.println(search(n,k,m,m-n+1));
	}
}

import java.util.Scanner;

public class FrodoPillows {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();

		int x = m/n;
		int left = k-1;
		int right = n-k;
		int p1=0,p2=0;

		int ans=x;

		int tot=x;
		while(tot < m)
		{
			int y=left;
			if(y > (x-1))
			{
				p1 = (((x-1)*x)/2) + y - (x-1);
			}
			else
			{
				p1 = ((x-1+x-y)*y)/2;
			}

			y=right;
			if(y > (x-1))
			{
				p2 = (((x-1)*x)/2) + y - (x-1);
			}
			else
			{
				p2 = ((x-1+x-y)*y)/2;
			}

			tot = x+p1+p2;
			if(tot==m)
				ans=x+1;
			else
				ans = x;
			x++;
		}//end while

		System.out.println(ans-1);
	}

}

//package contest760;

import java.io.*;
import java.util.*;

/**
 * Created by Brijesh on 23-01-2017.
 */
public class Main {
    static int e09$7=1000000007;
    static double e_06=0.000001;
    static long INF=1000000000000000L;
    static final String[] EMPTY_ARRAY = new String[0];
    static String d_loc="/home/brijesh/Downloads/";
    static String d_loc2="C:\\Users\\Brijesh\\Downloads\\";
    public static void main (String[] args) throws Exception {
        //BufferedReader br=new BufferedReader(new FileReader(d_loc+"A-small-attempt0.in"));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        StringBuilder sb = new StringBuilder();
        st=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        int k=Integer.parseInt(st.nextToken());
        if (m==n) System.out.println(1);
        else {
            long k2=k,n2=n;
            long sum=(-k2*k2) + k2 + (n2*k2) - ((n2*(n2+1))/2);
            long nx=m-sum;
            //System.out.println(sum+ " "+nx);
            long x=nx/n;
            if (x-k+1<=0 || x-n+k<=0) {
                m=m-n;
                x=1;
                int root=(int) Math.sqrt(m);
                int sqr=(int) Math.pow(root,2);
                x+=root;
                long end=x-n+k;
                long beg=x-k+1;
                long rem=0;
                if (end>1) {
                    long f=x-n+k;
                    rem+=f*(f-1)/2;
                } else if (beg>1) {
                    long f=x-k+1;
                    rem+=f*(f-1)/2;
                }
                long start=x+1;
                while (rem>0){
                    rem=rem-start;
                    if (rem>=0) x++;
                    start++;
                }
                System.out.println(x+1);
            } else System.out.println(x);
        }

        System.exit(0);
    }
}

import java.io.*;
import java.util.StringTokenizer;

public final class Main {
    private FScanner in;
    //    -------------I/O-------------    \\
    private PrintWriter out;

    public static void main(String[] args) {
        new Main().runIO();
    }

    boolean isPrime(int a) {
        if (a == 1) {
            return false;
        }
        for (int i = 2; i * i <= a; i++) {
            if (a % i == 0)
                return false;
        }
        return true;
    }

    // 1 2 3 4
    //
    public void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int ce = m / n;
        int z = 0;
        if (n - k > k) {
            z = k;
        } else {
            z = n - k + 1;
        }
        int sum = ((2 + (n - z - 1)) * (n - z)) / 2;
        int fr = 1 + (n - z);
        if (z == 1 || z == n) {
            while (fr + sum + n < m) {
                fr += 1;
                sum += n - 1;
            }
            if (fr + sum + n - z > m) {
                out.println(fr);
            } else {
                while (fr + sum + n - z <= m) {
                    sum -= n - z;
                    fr--;
                }
                out.println(fr);
            }
        } else {
            sum += (fr - 1 - (z - 2)) * (z - 1) / 2;
            while (fr + sum + n < m) {
                fr += 1;
                sum += n - 1;
            }
            out.println(fr);
        }
    }

    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main30 {

	public static void main(String[] args) throws IOException
	{
		BufferedReader in;
		File file = new File("in");
		StringBuilder out = new StringBuilder("");
		if (file.exists()) {
			in = new BufferedReader(new FileReader(file));
		} else {
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		String lines[];
		int n, m, k;
		lines = in.readLine().split("\\s+");
		n = Integer.parseInt(lines[0]);
		m = Integer.parseInt(lines[1]);
		k = Integer.parseInt(lines[2]);
		int s = m-n;
		int result = 1;
		int left = k -1 ;
		int right = n - k;
		int min = Math.min(left, right);
		int max = Math.max(left, right);
		int c = (int)Math.sqrt(s);
		int c1 = Math.min(min+1, c);

		result += c1;
		s -= c1*c1;
		//System.out.println(c1);

		int v = 2*c1-1;
		int r = n - v;
		for( int i = v+1, j = 1; j <= r; i++, j++  )
		{
			if ( s - i >= 0 )
			{
				s -= i;
				result++;
			}
		}

		result += s/n;
		System.out.println(result);

	}

	public static int[] readInts(String line)
	{
		String lines[] = line.split("\\s+");
		int result[] = new int[lines.length];
		for( int i = 0; i < lines.length ; i++ )
		{
			result[i] = Integer.parseInt(lines[i]);
		}
		return result;
	}
}

// CodeForces Round #760 B TODO

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class FrodoPillows {

	int n,m,k;
	int maxFrodo;

	private void readData(BufferedReader bin) throws IOException {
		String s = bin.readLine();
		String []ss = s.split(" ");
		n = Integer.parseInt(ss[0]);
		m = Integer.parseInt(ss[1]);
		k = Integer.parseInt(ss[2]);
	}

	long noHurtSum(int nf, int k) {
		long np=0;

		if (nf<=0) {
			return 0;
		} else if (nf<k) {
			np = (nf*(nf+1))/2 + (k-nf);
		} else {
			np = (k*(k+1))/2 + k*(nf-k);
		}
		System.out.printf("noHurtSum(%d,%d) = %d\n", nf,k,np);
		return np;
	}

	long nPill(int nf) {
		long np = noHurtSum(nf, k);
		np += noHurtSum(nf-1, n-k);
		return np;
	}

	int searchMaxNf(int i0, int i1) {
		if (i1-i0<2) {
			return i0;
		}
		int ii = (i0 + i1)/2;
		long np = nPill(ii);
		int mxp;
		if (np>m) {
			mxp = searchMaxNf(i0, ii);
		} else {
			mxp = searchMaxNf(ii, i1);
		}
		return mxp;
	}

	private void calculate() {
		maxFrodo = searchMaxNf(1, m+1);
	}

	void printRes() {
		System.out.println(maxFrodo);
	}

	public static void main(String[] args) throws IOException {
		// BufferedReader bin = new BufferedReader(new FileReader("cactus.in"));
		BufferedReader bin = new BufferedReader(
				new InputStreamReader(System.in));
		FrodoPillows l = new FrodoPillows();
		l.readData(bin);
		l.calculate();
		l.printRes();
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class line
{
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);
		long n = s.nextLong();
		long m = s.nextLong();
		long k = s.nextLong();
		long left = k-1;
		long right = n-k;
		long tleft = 0;
		long tright = 0;
		m = m- n;
		long ans = 1;
		while(m>0){

			if(tleft==left & tright == right){
			    ans = ans+(int)m/n;
			    break;
			}
			ans++;
			if(tleft<left) {
				tleft++;
			}
			if(tright<right) {
				tright++;
			}
			m = m-tleft-tright-1;
		}
		System.out.println(ans);
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.math.BigInteger;

import javax.management.Query;

import com.sun.corba.se.impl.orbutil.closure.Constant;
import com.sun.org.apache.bcel.internal.generic.SWAP;

public class fstclass {
	public static final int N = 212345;
	static int[][] d = new int[100][100];
	public static void main(String[] args) {
		InputStream inputStream = System.in;
        InputReader in = new InputReader(inputStream);
        int n, m, i, j;
        n = in.nextInt();
        m = in.nextInt();
        int k = in.nextInt();
        m -= n;
        int l = 0, r = m;
        while(r - l > 1) {
        	int md = (l + r) >> 1;
        	int cnt = 0;
        	if(md >= k) {
        		cnt += (md - k + 1 + md) * k / 2;
        	}
        	else {
        		cnt += md * (md + 1) / 2;
        	}
        	if(n - k <= md) {
        		cnt += (md - (n - k + 1) + 1 + md) * (n - k + 1) / 2;
        		cnt -= md;
        	}
        	else {
        		cnt += md * (md + 1) / 2;
        		cnt -= md;
        	}
        	if(cnt > m)
        		r = md;
        	else
        		l = md;
        }
        System.out.print(l + 1);
	}
	/*public static int kth(int t, int k) {
		int m = 0;
		for(int i = 19; i >= 0; i --) {
			if(((1 << i) & k) != 0) {
				m = Math.max(m, mx[t][i]);
				t = p[t][i];
			}
		}
		return m;
	}*/

	/*public static int lca(int a, int b) {
		if(upper(a, b)) return a;
		if(upper(b, a)) return b;
		for(int i = 19; i >= 0; i --) {
			if(!upper(p[a][i], b)) {
				a = p[a][i];
			}
		}
		return p[a][0];
	}*/
/*	public static boolean upper(int a, int b) {
		return tin[a] <= tin[b] && tout[a] >= tout[b];
	}
	public static void dfs(int t, int f, int d, int s) {
		p[t][0] = f;
		mx[t][0] = d;
		dp[t] = s;
		for(int i = 1; i <= 19; i ++) {
			p[t][i] = p[p[t][i - 1]][i - 1];
			mx[t][i] = Math.max(mx[p[t][i - 1]][i - 1], mx[t][i - 1]);
		}
		tin[t] = +timer;
		for(int i = 0; i < v[t].size(); i ++) {
			int to = v[t].get(i);
			if(to != f) {
				dfs(to, t, vxy[t].get(i), s + 1);
			}
		}
		tout[t] = ++timer;
	}
	public static int find(int parentd) {*/
	/*	if(parent[parentd] == parentd)
			return parentd;
		return parent[parentd] = find(parent[parentd]);
	}*/
	/*public static void merg(int l, int r) {
		if(l >= r)
			return ;
		int m = (l + r) / 2;
		merg(l,  m);
		merg(m + 1, r);
		int p1 = l, p2 = m + 1, p = l;
		while(p1 <= m && p2 <= r) {
			if(a[p1] <= a[p2]) {
				a1[p] = a[p1];
				id1[p ++] = id[p1 ++];
			}
			else {
				a1[p] = a[p2];
				id1[p ++] = id[p2 ++];
			}
		}
		while(p1 <= m) {
			a1[p] = a[p1];
			id1[p ++] = id[p1 ++];
		}
		while(p2 <= r) {
			a1[p] = a[p2];
			id1[p ++] = id[p2 ++];
		}
		for(int i = l; i <= r; i ++) {
			a[i] = a1[i];
			id[i] = id1[i];
		}
	}
	*/
	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

import java.io.*;
import java.text.DecimalFormat;
import java.util.*;
import java.awt.Point;

public class Newbie {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t =1;
        while (t > 0) {
            s.sol();
            t--;
        }
        out.close();
    }
           /* static class descend implements Comparator<pair1> {
                public int compare(pair1 o1, pair1 o2) {
                    if (o1.pop != o2.pop)
                        return (int) (o1.pop - o2.pop);
                    else
                        return o1.in - o2.in;
                }
            }*/

    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static class ascend implements Comparator<pair> {
        public int compare(pair o1, pair o2) {
            return o2.b - o1.b;
        }
    }

    static class extra {

        static boolean v[] = new boolean[100001];
        static List<Integer> l = new ArrayList<>();
        static int t;

        static void shuffle(int a[]) {
            for (int i = 0; i < a.length; i++) {
                int t = (int) Math.random() * a.length;
                int x = a[t];
                a[t] = a[i];
                a[i] = x;
            }
        }

        static void shufflel(long a[]) {
            for (int i = 0; i < a.length; i++) {
                int t = (int) Math.random() * a.length;
                long x = a[t];
                a[t] = a[i];
                a[i] = x;
            }
        }

        static int gcd(int a, int b) {
            if (b == 0)
                return a;
            else
                return gcd(b, a % b);
        }

        static boolean valid(int i, int j, int r, int c) {
            if (i >= 0 && i < r && j >= 0 && j < c) {
                // System.out.println(i+" /// "+j);
                return true;
            } else {
                //  System.out.println(i+" //f "+j);
                return false;
            }
        }

        static void seive() {
            for (int i = 2; i < 101; i++) {
                if (!v[i]) {
                    t++;
                    l.add(i);
                    for (int j = 2 * i; j < 101; j += i)
                        v[j] = true;
                }
            }
        }

        static int binary(LinkedList<Integer> a, long val, int n) {
            int mid = 0, l = 0, r = n - 1, ans = 0;
            while (l <= r) {
                mid = (l + r) >> 1;
                if (a.get(mid) == val) {
                    r = mid - 1;
                    ans = mid;
                } else if (a.get(mid) > val)
                    r = mid - 1;
                else {
                    l = mid + 1;
                    ans = l;
                }
            }
            return (ans + 1);
        }

        static long fastexpo(long x, long y) {
            long res = 1;
            while (y > 0) {
                if ((y & 1) == 1) {
                    res *= x;
                }
                y = y >> 1;
                x = x * x;
            }
            return res;
        }

        static long lfastexpo(long x, long y, long p) {
            long res = 1;
            x = x % p;
            while (y > 0) {
                if ((y & 1) == 1) {
                    res = (res * x) % p;
                }
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }

               /* void dijsktra(int s, List<pair> l[], int n) {
                    PriorityQueue<pair> pq = new PriorityQueue<>(new ascend());
                    int dist[] = new int[100005];
                    boolean v[] = new boolean[100005];
                    for (int i = 1; i <= n; i++)
                        dist[i] = 1000000000;
                    dist[s] = 0;
                    for (int i = 1; i < n; i++) {
                        if (i == s)
                            pq.add(new pair(s, 0));
                        else
                            pq.add(new pair(i, 1000000000));
                    }
                    while (!pq.isEmpty()) {
                        pair node = pq.remove();
                        v[node.a] = true;
                        for (int i = 0; i < l[node.a].size(); i++) {
                            int v1 = l[node.a].get(i).a;
                            int w = l[node.a].get(i).b;
                            if (v[v1])
                                continue;
                            if ((dist[node.a] + w) < dist[v1]) {
                                dist[v1] = dist[node.a] + w;
                                pq.add(new pair(v1, dist[v1]));
                            }
                        }
                    }
                }*/
    }

    static class pair {
        int a;
        int b;

        public pair(int a, int b) {
            this.a = a;
            this.b = b;
        }
    }

    static class pair1 {
        pair p;
        int in;

        public pair1(pair a, int n) {
            this.p = a;
            this.in = n;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000");
        extra e = new extra();
        long mod = (long) (1000000007);

        void sol() throws IOException {
            long n = sc.ni();
            long m = sc.ni();
            long k = sc.ni();
            if (n == 1)
                out.println(m);
            else
                out.println(upper(m, n));
        }

        long upper(long m, long n) {
            long l = 1;
            long r = m;
            long ans = 0;
            while (l <= r) {
                long mid = (l + r) / 2;
                if (valid(m, mid, n)) {
                    l = mid + 1;
                    ans = mid;
                } else
                    r = mid - 1;
            }
            return ans;
        }

        boolean valid(long m, long mid, long n) {
            double d = ((m - mid) * 1.0) / (n - 1);
            if ((int) d == 0)
                return false;
            long ceil = (long) Math.ceil(d);
            return ((mid - ceil) < 2);
        }
    }
}

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {

        new Main().solve();
    }

    int inf = 1000000000;
    int mod = 1000000007;
    double eps = 0.0000000001;

    PrintWriter out;

    int n;
    int m;

    void solve() throws IOException {

        Reader in;
        BufferedReader br;

        try {

            br = new BufferedReader( new FileReader("input.txt") );
            in = new Reader("input.txt");
            out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );
        }
        catch (Exception e) {

            br = new BufferedReader( new InputStreamReader( System.in ) );
            in = new Reader();
            out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );
        }

        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int k2 = n-k+1;

        int l = 0;
        int r = m;

        int ans = 0;

        while (l <= r) {

            int x = (l+r)/2;

            int sum = x;

            if (k > 1)
                sum += sum(Math.max(1, x-k), x-1);
            if (k > x)
                sum += (k-x);

            if (k2 > 1)
                sum += sum(Math.max(1, x-k2), x-1);
            if (k2 > x)
                sum += (k2-x);

            //System.err.println(x+" "+sum+" "+k+" "+k2);

            if (sum <= m) {

                ans = x;
                l = x+1;
            }
            else {

                r = x-1;
            }

        }

        out.print(ans);
        out.flush();
        out.close();
    }

    int sum(int l, int r) {

        l--;

        if (l > r)
            return 0;

        int s1 = r*(r+1)/2;
        int s2 = l*(l+1)/2;

        return s1-s2;
    }

    class Pair implements Comparable<Pair>{

        int a;
        int b;

        Pair(int a, int b) {

            this.a = a;
            this.b = b;
        }

        public int compareTo(Pair p) {

            return 0;
        }
    }

    class Item {

        int a;
        int b;
        int c;

        Item(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

    }

    class Reader {

        BufferedReader  br;
        StringTokenizer tok;

        Reader(String file) throws IOException {
            br = new BufferedReader( new FileReader(file) );
        }

        Reader() throws IOException {
            br = new BufferedReader( new InputStreamReader(System.in) );
        }

        String next() throws IOException {

            while (tok == null || !tok.hasMoreElements())
                tok = new StringTokenizer(br.readLine());
            return tok.nextToken();
        }

        int nextInt() throws NumberFormatException, IOException {
            return Integer.valueOf(next());
        }

        long nextLong() throws NumberFormatException, IOException {
            return Long.valueOf(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.valueOf(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

    }

}

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {

        new Main().solve();
    }

    int inf = 1000000000;
    int mod = 1000000007;
    double eps = 0.0000000001;

    PrintWriter out;

    int n;
    int m;

    void solve() throws IOException {

        Reader in;
        BufferedReader br;

        try {

            br = new BufferedReader( new FileReader("input.txt") );
            in = new Reader("input.txt");
            out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );
        }
        catch (Exception e) {

            br = new BufferedReader( new InputStreamReader( System.in ) );
            in = new Reader();
            out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );
        }

        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int k2 = n-k+1;

        int l = 1;
        int r = m;

        int ans = 0;

        while (l <= r) {

            int x = (l+r)/2;

            long sum = x;

            if (k > 1)
                sum += sum(Math.max(1, x-k), x-1);
            if (k > x)
                sum += (k-x);

            if (k2 > 1)
                sum += sum(Math.max(1, x-k2), x-1);
            if (k2 > x)
                sum += (k2-x);

            //System.err.println(x+" "+sum+" "+k+" "+k2);

            if (sum <= m) {

                ans = x;
                l = x+1;
            }
            else {

                r = x-1;
            }

        }

        out.print(ans);
        out.flush();
        out.close();
    }

    long sum(int l, int r) {

        l--;

        if (l > r)
            return 0;

        long s1 = 1l*r*(r+1)/2;
        long s2 = 1l*l*(l+1)/2;

        return s1-s2;
    }

    class Pair implements Comparable<Pair>{

        int a;
        int b;

        Pair(int a, int b) {

            this.a = a;
            this.b = b;
        }

        public int compareTo(Pair p) {

            return 0;
        }
    }

    class Item {

        int a;
        int b;
        int c;

        Item(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

    }

    class Reader {

        BufferedReader  br;
        StringTokenizer tok;

        Reader(String file) throws IOException {
            br = new BufferedReader( new FileReader(file) );
        }

        Reader() throws IOException {
            br = new BufferedReader( new InputStreamReader(System.in) );
        }

        String next() throws IOException {

            while (tok == null || !tok.hasMoreElements())
                tok = new StringTokenizer(br.readLine());
            return tok.nextToken();
        }

        int nextInt() throws NumberFormatException, IOException {
            return Integer.valueOf(next());
        }

        long nextLong() throws NumberFormatException, IOException {
            return Long.valueOf(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.valueOf(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

    }

}

import java.util.Scanner;
public class pillow {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int n= s.nextInt();
		int m = s.nextInt();
		int k = s.nextInt();
		int p = m-n;
        int i=1;
        int a=0;
        int b=0;
        int count =1;
        if(n==1){
            count+=m-1;
            p=0;
        }
		while(p>0){
            a=k-i-1;
            if(a<0)
                a=0;
            b=k+i-1;
            if(b>n)
                b=n-1;
            count++;
            p-=b-a+1;
			i++;
		}
		System.out.println(count);
	}
}

import java.util.Scanner;

public class frodoAndPillow {

	public static int solveFor(int n ,int m,int k) {
		int start=1,end=m-n;
		int ans=1;
		while(start<=end) {
		int middle=(start+end)/2;

		if(totalPillows(n,k,middle)>m) end=middle-1;
		else {
			start=middle+1;
			ans=middle;
		}

		}
		return ans;
	}

	public static int totalPillows(int n,int k,int possibleAnswer) {
		int rightBeds=n-k;
		int leftBeds=n-rightBeds-1;
		int rightSum=(rightBeds*possibleAnswer)-(((rightBeds+1)*rightBeds)/2);
		int leftSum=(leftBeds*possibleAnswer)-(((leftBeds+1)*leftBeds)/2);
		return  possibleAnswer+rightSum+leftSum;
	}

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int m=scan.nextInt();
		int k=scan.nextInt();
		System.out.print(solveFor(n,m,k));

	}

}

import java.util.*;

public class Frodo_and_pillows {

	public static boolean works(double n, long m, double k, double x) {

		if (x >= k) {
			m -= k / 2 * (x - k + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
		}
		if (x >= n - k + 1) {
			m -= (n - k + 1) / 2 * (x - (n - k + 1) + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
		}
		m += x;

		// System.out.println(x + " " + m);

		return m >= 0 ? true : false;

	}

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		double n = input.nextInt();
		long m = input.nextInt();
		double k = input.nextInt();

		input.close();

		int lo = 0;
		int hi = 1000000100;

		while (lo < hi - 1) {
			int mid = (lo + hi) / 2;
			if (works(n, m, k, mid)) {
				lo = mid;
			} else {
				hi = mid;
			}
		}

		System.out.println(lo);

	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();
            long m = in.nextLong();
            long k = in.nextLong();

            long l = 1, r = m;
            long ans = 0;
            while (l <= r) {
                long mid = (l + r) >> 1;
                long lS = k * (mid - k);
                lS += k * (k + 1) / 2;

                long rS = mid * (n - k);
                rS -= (n - k) * (n - k + 1) / 2;

                if (lS + rS <= m) {
                    l = mid + 1;
                    ans = mid;
                } else r = mid - 1;
            }
            out.println(ans);
        }

    }
}

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 *
 */
public class TaskB {
    public static void main(String[] args) {
        InputStream inputStream;
        String str = null;
        if(str == null){
            inputStream = System.in;
        }else{
            inputStream = new ByteArrayInputStream(str.getBytes());
        }

        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(1, in, out);
        out.close();
    }

    static class Solver {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long numBeds = in.nextInt();
            long numPillows = in.nextInt();
            long frodoPos = in.nextInt();

            numPillows -= numBeds;

            long frodoPillows = 1;

            long num = 1;

            long l = Math.max(0, num-frodoPos-1);
            long r = Math.max(0, frodoPos+num-numBeds-1);
            while(num<numBeds && num*num - l*(l+1)/2 - r*(r+1)/2 <= numPillows){
                //System.out.println(l + " " + r);
                num++;
                frodoPillows++;
                l = Math.max(0, num-frodoPos-1);
                r = Math.max(0, frodoPos+num-numBeds-1);
            }

            num--;
            numPillows -= num*num - l*(l+1)/2 - r*(r+1)/2;

            frodoPillows += numPillows/numBeds;

            System.out.println(frodoPillows);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CF760B {

	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		//OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(System.out);
		int l,m,p,a,b,c,S,B;
		l=in.nextInt();
		m=in.nextInt();
		p=in.nextInt();
		int h=0;
		m=m-l;
		if(m>0){
		S=Math.min(p, l-p);
		B=Math.max(p, l-p);
		a=S;
		b=B-S;
		c=(2*m-B*B+S*S-2*B*S)/(2*l);
		h=a+b+c;
		//out.println(a+" "+b+" "+c);
		}

		out.println(h+1);

		out.close();

}
	int sieveOfEratosthenes(int n)
    {
        // Create a boolean array "prime[0..n]" and initialize
        // all entries it as true. A value in prime[i] will
        // finally be false if i is Not a prime, else true.
        boolean prime[] = new boolean[n+1];
        for(int i=0;i<n;i++)
            prime[i] = true;

        for(int p = 2; p*p <=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if(prime[p] == true)
            {
                // Update all multiples of p
                for(int i = p*2; i <= n; i += p)
                    prime[i] = false;
            }
        }
        int c=0;
        for(int i = 2; i <= n; i++)
        {
            if(prime[i] == true)
                c++;
        }
        return c;
        // Print all prime numbers
       /* for(int i = 2; i <= n; i++)
        {
            if(prime[i] == true)
                System.out.print(i + " ");
        }*/
    }
static class Pair implements Comparable<Pair> {
	int u;
	int v;
	BigInteger bi;
	public Pair(int u, int v) {
		this.u = u;
		this.v = v;
	}

	public int hashCode() {
		int hu = (int) (u ^ (u >>> 32));
		int hv = (int) (v ^ (v >>> 32));
		return 31 * hu + hv;
	}

	public boolean equals(Object o) {
		Pair other = (Pair) o;
		return u == other.u && v == other.v;
	}

	public int compareTo(Pair other) {
		return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);
	}

	public String toString() {
		return "[u=" + u + ", v=" + v + "]";
	}
}
public static void debug(Object... o) {
	System.out.println(Arrays.deepToString(o));
}
static long modulo(long a,long b,long c) {
	long x=1;
	long y=a;
	while(b > 0){
		if(b%2 == 1){
			x=(x*y)%c;
		}
		y = (y*y)%c; // squaring the base
		b /= 2;
	}
	return  x%c;
}
public static long getClosestK(long[] a, long x) {

    int low = 0;
    int high = a.length - 1;

    while (low <= high) {
        int mid = (low + high) / 2;

        // test lower case
        if (mid == 0) {
            if (a.length == 1) {
                return a[0];
            }

            return Math.min(Math.abs(a[0] - x), Math.abs(a[1] - x)) + x;
        }

        // test upper case
        if (mid == a.length - 1) {
            return a[a.length - 1];
        }

        // test equality
        if (a[mid] == x || a[mid + 1] == x) {
            return x;
        }

        // test perfect range.
        if (a[mid] < x  && a[mid + 1] > x) {
            return Math.min(Math.abs(a[mid] - x), Math.abs(a[mid + 1] - x)) + x;
        }

        // keep searching.
        if (a[mid] < x) {
            low = mid + 1;
        } else {
            high = mid;
        }
    }

    throw new IllegalArgumentException("The array cannot be empty");
}
long factorial(long n,long M)
{
    long ans=1;
    while(n>=1)
    {
        ans=(ans*n)%M;
        n--;
    }
    return ans;
}
static long gcd(long x, long y)
{
	if(x==0)
		return y;
	if(y==0)
		return x;
	long r=0, a, b;
	a = (x > y) ? x : y; // a is greater number
	b = (x < y) ? x : y; // b is smaller number
	r = b;
	while(a % b != 0)
	{
		r = a % b;
		a = b;
		b = r;
	}
	return r;
}
static class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream inputstream) {
		reader = new BufferedReader(new InputStreamReader(inputstream));
		tokenizer = null;
	}

	public String nextLine(){
		String fullLine=null;
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				fullLine=reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			return fullLine;
		}
		return fullLine;
	}
	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
}
}

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();

        int l = 1, r = m + 1;
        while(l < r - 1) {
            int mid = (l + r) / 2;
            if (check(mid, n, m, k)) {
                l = mid;
            } else {
                r = mid;
            }
        }
        System.out.println(l);
    }

    public static boolean check(int mid, int n, int m, int k) {
        long leftmid = getMin(k + 1, mid);
        long rightmid = getMin(n - k, mid);
        long min = leftmid + rightmid - mid;
        return m >= min;
    }

    static long getMin(long s, long x) {
        return s >= x ? x * (x + 1) / 2 + (s - x) : s * (x + x - s + 1) / 2;
    }
}

import java.util.*;

public class Frodo_and_pillows {

	public static boolean works(double n, long m, double k, double x) {

		if (x - 1 >= k) {
			m -= k / 2 * (x - k + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
		}
		if (x - 1 >= n - k + 1) {
			m -= (n - k + 1) / 2 * (x - (n - k + 1) + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
		}
		m += x;

		// System.out.println(x + " " + m);

		return m >= 0 ? true : false;

	}

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		double n = input.nextInt();
		long m = input.nextInt();
		double k = input.nextInt();

		input.close();

		int lo = 1;
		int hi = 1000000007;

		while (lo < hi - 1) {
			int mid = (lo + hi) / 2;
			if (works(n, m, k, mid)) {
				lo = mid;
			} else {
				hi = mid;
			}
		}

		System.out.println(lo);

	}

}

import java.io.*;
import java.util.StringTokenizer;

public final class Main {
    private FScanner in;
    //    -------------I/O-------------    \\
    private PrintWriter out;

    public static void main(String[] args) {
        new Main().runIO();
    }

    boolean isPrime(int a) {
        if (a == 1) {
            return false;
        }
        for (int i = 2; i * i <= a; i++) {
            if (a % i == 0)
                return false;
        }
        return true;
    }

    // 1 2 3 4
    //
    public void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int z = 0;
        if (n==1){
            out.println(m);
            return;
        }
        if (n - k + 1 > k) {
            z = k;
        } else {
            z = n - k + 1;
        }
        long sum = ((2 + (n - z - 1)) * (n - z)) / 2;
        long fr = 1 + (n - z);
        long tmp1 = fr - (z - 1);
        if (z != 1 && z != n) {
            sum += (((2 * tmp1 + (z - 2)) * (z - 1)) / 2);
        }
        int tmp = 1;
        if (tmp1==1){
            tmp++;
        }
        while (fr + sum > m) {
            fr--;
            sum -= (n - 1) - tmp;
            if (tmp1>1)
                tmp1--;
            if (tmp1==1)
                tmp++;
            tmp++;
        }
        while (fr + sum + n <= m) {
            fr += 1;
            sum += n - 1;
        }
        out.println(fr);
    }

    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}

import java.io.*;
import java.util.*;

public class ProblemB {

    public static void main(String[] args) throws IOException {
        init();
        new ProblemB().run();
        out.flush();
        out.close();
    }

    static void init() throws IOException {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in.ordinaryChars(0, 65535);
        in.wordChars(0, 65535);
        in.whitespaceChars(' ', ' ');
        in.whitespaceChars('\n', '\n');
        in.whitespaceChars('\r', '\r');
    }

    // класс для пар
    class Pair<L, R> {
        private final L X;
        private final R Y;

        public Pair(L X, R Y) {
            this.X = X;
            this.Y = Y;
        }

        public L getX() {
            return X;
        }

        public R getY() {
            return Y;
        }

        @Override
        public int hashCode() {
            return X.hashCode() ^ Y.hashCode();
        }

        @Override
        public boolean equals(Object o) {
            if (!(o instanceof Pair)) return false;
            Pair pairo = (Pair) o;
            return X.equals(pairo.getX()) && Y.equals(pairo.getY());
        }
    }

    static final long INFL = 200000000000000000L;
    static final int INF = 2000000000;
    static final boolean DEBUG = true;

    static StreamTokenizer in;
    static PrintWriter out;

    static void print(String s) {
        print(s, 0);
    }

    static void print(String s, int debug) {
        if (debug == 0 || DEBUG) {
            out.print(s);
        }
    }

    static void println(String s) {
        println(s, 0);
    }

    static void println(String s, int debug) {
        if (debug == 0 || DEBUG) {
            out.println(s);
        }
    }

    static void printArray(int[] arr) {
        println(Arrays.toString(arr));
    }

    static void printArray(char[] arr) {
        println(Arrays.toString(arr));
    }

    static void printArray(String[] arr) {
        println(Arrays.toString(arr));
    }

    static void sort(int[] a) {
        Random rnd = new Random();
        for (int i = a.length - 1; i > 0; i--) {
            int index = rnd.nextInt(i);
            a[i] ^= a[index];
            a[index] ^= a[i];
            a[i] ^= a[index];
        }
        Arrays.sort(a);
    }

    static char[] inChars;
    static int inCharsInd;

    static String next() throws IOException {
        in.nextToken();
        return in.sval;
    }

    static char nextChar() throws IOException {
        while (inChars == null || inCharsInd >= inChars.length) {
            inChars = next().toCharArray();
            inCharsInd = 0;
        }
        return inChars[inCharsInd++];
    }

    static int nextInt() throws IOException {
        return Integer.valueOf(next());
    }

    static double nextDouble() throws IOException {
        return Double.valueOf(next());
    }

    static long nextLong() throws IOException {
        return Long.valueOf(next());
    }

    private void run() throws IOException {
        solve();
    }

    int K, L, M, N, P;

    private void solve() throws IOException {
        N = nextInt();
        M = nextInt();
        K = nextInt();
        M = M - N;

        int answer = 1;
        int radius = 0;
        int curplus = 1;
        int left = K;
        int right = K;

        int newleft, newright;
        while (M >= 0){
            if (M >= curplus){
                M -= curplus;
                newleft = Math.max(left-1, 1);
                newright = Math.min(right+1, N);
                if (newleft == left && newright == right){
                    int incr = M/N;
                    answer += incr;
                    break;
                } else {
                    left = newleft; right = newright;
                    curplus = right - left + 1;
                    answer++;
                }
            } else {
                break;
            }
        }
        out.println(answer);

    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author zodiacLeo
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        FastPrinter out = new FastPrinter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB
    {
        public void solve(int testNumber, FastScanner in, FastPrinter out)
        {
            long n = in.nextInt();
            long p = in.nextInt();
            long pos = in.nextInt();
            long a = pos - 1;
            long b = n - pos;

            p -= n;
            long A = a * (a + 1);
            A /= 2;
            long B = b * (b + 1);
            B /= 2;

            long count = 1;
            if (p > 0)
            {
                count += (p + B + A) / (a + b + 1);
            }
            out.println(count);

        }

    }

    static class FastScanner
    {
        public BufferedReader br;
        public StringTokenizer st;

        public FastScanner(InputStream is)
        {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        public String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                String s = null;
                try
                {
                    s = br.readLine();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

    }

    static class FastPrinter extends PrintWriter
    {
        public FastPrinter(OutputStream out)
        {
            super(out);
        }

        public FastPrinter(Writer out)
        {
            super(out);
        }

    }
}

import java.util.*;

public class FrodoAndPillows {

	public boolean check(int frodoVal, int frodoBed, int numHobbits, int numPillows)
	{
		long sum = frodoVal;

		int frodoLeft = frodoBed - 1;
		int frodoRight = numHobbits-frodoBed;

		if(frodoLeft < frodoVal)
		{
			sum += (frodoLeft*frodoVal - ((frodoLeft)*(frodoLeft+1))/2);
		}
		else
		{
			sum += ((frodoVal-1)*frodoVal - ((frodoVal-1)*(frodoVal))/2);
			sum += frodoLeft-(frodoVal-1);
		}

		if(frodoRight < frodoVal)
		{
			sum += (frodoRight*frodoVal - ((frodoRight)*(frodoRight+1))/2);
		}
		else
		{
			sum += ((frodoVal-1)*frodoVal - ((frodoVal-1)*(frodoVal))/2);
			sum += frodoRight-(frodoVal-1);
		}

		if(sum <= numPillows)
			return true;
		else
			return false;
	}

	public int bsearch(int start, int end, int numHobbits, int numPillows, int frodoBed)
	{
		if(start == end)
		{
			return start;
		}
		else
		{
			int mid = start + (end-start)/2;

			if(check(mid, frodoBed, numHobbits, numPillows))
			{
				if(mid!= start)
					return bsearch(mid, end, numHobbits, numPillows, frodoBed);
				else
				{
					if(check(mid+1, frodoBed, numHobbits, numPillows))
						return mid+1;
					else
						return mid;
				}
			}
			else
				return bsearch(start, mid-1, numHobbits, numPillows, frodoBed);
		}
	}

	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int numHobbits = sc.nextInt();
		int numPillows = sc.nextInt();
		int frodoBed = sc.nextInt();
		int frodoValue = numPillows - (numHobbits - 1);

		FrodoAndPillows obj = new FrodoAndPillows();
		System.out.println(obj.bsearch(1, frodoValue, numHobbits, numPillows, frodoBed));
	}
}

import java.util.Scanner;

public class Frodo {
	static long pillows, pos, len;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		len = in.nextLong();
		pillows = in.nextLong();
		pos = in.nextLong();

		System.out.println(binSearch(0L, 1L << 30));
	}

	static boolean check(long mid) {
		long sum = 0, k = 0;
		k = Math.max(1, mid - pos+1);
		sum = (mid - k) * (mid + k - 1);
		sum /= 2;
		k = Math.max(mid - (len - pos) , 1);
		sum += ((mid - k) * (mid + k - 1)) / 2;
		sum += mid;
		return pillows >= sum;
	}

	static long binSearch(long l, long r) {
		long ans = -1, mid = 0;
		while (l != r) {
			mid = (l + r) / 2;
			if (check(mid)) {
				ans = mid;
				l = mid + 1;
			} else {
				r = mid;
			}
		}
		return ans;
	}
}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.stream.Stream;

/**
 * Success is not final, failure is not fatal.
 * The courage to continue is what counts.
 * @author bodmas
 */
public class ProblemB {

    private int solve(int n, int m, int k) {
        int left = k - 1;
        int right = n - k;
        int l = 1;
        int r = m + 1;
        while (r - l > 1) {
            int h = l + r >> 1;
            if (find(h, left, right) <= m)
                l = h;
            else
                r = h;
        }
        return l;
    }

    private static long find(int h, int left, int right) {
        return (h - 1L) * left - 1L * left * (left - 1) / 2 + (h - 1L) * right - 1L * right * (right - 1) / 2 + h;
    }

    public static void main(String[] args) throws IOException {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {
            int[] a = Stream.of(in.readLine().split(" ")).mapToInt(Integer :: parseInt).toArray();
            out.println(new ProblemB().solve(a[0], a[1], a[2]));
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyBufferedReader in = new MyBufferedReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, MyBufferedReader in, PrintWriter out) {
            int[] data = in.getALineOfInts(3);
            int n = data[0];
            int m = data[1];
            int k = data[2];

            long rem = m - n;
            long start = 0;
            long end = rem + 1;
            while (start < end) {
                long mid = (start + end) / 2;
                long atBegin = k - 1;
                long atEnd = n - k;
                long minNeeded = sum(atBegin, mid) + sum(atEnd, mid);
                if (rem < minNeeded + mid) {
                    end = mid;
                } else {
                    start = mid + 1;
                }
            }

            if (start == 0) {
                out.println(1);
            } else {
                out.println(start);
            }
        }

        private long sum(long num, long mid) {
            if (num == 0 || mid == 0) {
                return 0;
            }

            return num * mid - ((num * (num + 1)) / 2);
        }

    }

    static class MyBufferedReader {
        BufferedReader in;

        public MyBufferedReader(InputStream s) {
            this.in = new BufferedReader(new InputStreamReader(s));
        }

        public int[] getALineOfInts(int numExpected) {
            int[] res = new int[numExpected];
            StringTokenizer st = null;
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < numExpected; i++)
                res[i] = Integer.parseInt(st.nextToken());
            return res;
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaswant Singh[joney_000][jaswantsinghyadav007@gmail.com][jaswant.singh@practo.com]
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        FastReader in;
        PrintWriter out;

        void set(FastReader in, PrintWriter out) {
            this.in = in;
            this.out = out;
        }

        public void solve(int testNumber, FastReader in, PrintWriter out) {
            set(in, out);
            int n = i();
            int m = i();
            int k = i();
            long ans = 1;
            m -= n;
            int pos = 1;
            int l = k;
            int r = k;
            while (l != 1 || r != n) {
                //out.write("l = "+ l + " m="+m + " ans = "+pos+"\n");
                if (l == 1) {
                    m -= (k - 1);
                } else if (r == n) {
                    m -= (n - k);
                } else {
                    m -= (k - l);
                    m -= (r - k);
                }
                m -= 1;
                if (m <= 0) break;
                pos++;
                if (l > 1) l--;
                if (r < n) r++;
            }
            ans = pos + m / n;
            out.write("" + ans + "");

        }

        int i() {
            //return Integer.parseInt(br.readLine().trim());
            return in.nextInt();
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[2 * 1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = read();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		long m = sc.nextLong();
		long k = sc.nextLong();
		k = Math.max(k, n-k+1);

		long sum = (2*m-k+1)*k/2;
		sum = sum + (n-k)*(2*m-n+k-1)/2;

		long ans = m;
		while(sum > m){

			sum = sum-n;
			ans--;

		}

//		long t = (sum-m)/n + ((sum-m)%n==0?0:1);
//		ans = ans - t;

		System.out.println(ans);
	}

}

	import java.util.Scanner;
	import java.io.*;
	import java.util.*;
	import java.math.*;
	import java.lang.*;
	import static java.lang.Math.*;

	public class TestClass implements Runnable
	{
		public static void main(String args[])
		{
			new Thread(null, new TestClass(),"TESTCLASS",1<<26).start();
		}
		public void run()
		{
			//Scanner scan=new Scanner(System.in);
			InputReader hb=new InputReader(System.in);
			PrintWriter w=new PrintWriter(System.out);

			int n=hb.nextInt();
			int m=hb.nextInt();
			int k=hb.nextInt();

			int start=1;
			int end=m;
			long count=0;
			int x=0;
			int max=0;
			while(start<end)
			{
				int left=k-1;
				int right=n-k;

				x=start + (end-start)/2;
				count=x;
				//w.println(start+" "+end);
				//w.print(count+" ");
				if(left>x-1)
					count+= x*(x-1)/2  +  left  -  (x-1);
				else
					count+= left*(x-1 + x-left)/2;
				//w.print(count+" ");
				if(right>x-1)
					count+= x*(x-1)/2  +  right  -  (x-1);
				else
					count+= right*(x-1 + x-right)/2;
				//w.println(count);
				if(count>m)
					end=x;
				else
				{
					start=x+1;
					if(x>max)
						max=x;
				}
				if(count==m)
					break;
			}
			w.print(max);
			w.close();
		}

		private void shuffle(char[] arr)
		{
			Random ran = new Random();
			for (int i = 0; i < arr.length; i++) {
				int i1 = ran.nextInt(arr.length);
				int i2 = ran.nextInt(arr.length);

				char temp = arr[i1];
				arr[i1] = arr[i2];
				arr[i2] = temp;
			}
		}
		static class InputReader
		{
			private InputStream stream;
			private byte[] buf = new byte[1024];
			private int curChar;
			private int numChars;
			private SpaceCharFilter filter;

			public InputReader(InputStream stream)
			{
				this.stream = stream;
			}

			public int read()
			{
				if (numChars==-1)
					throw new InputMismatchException();

				if (curChar >= numChars)
				{
					curChar = 0;
					try
					{
						numChars = stream.read(buf);
					}
					catch (IOException e)
					{
						throw new InputMismatchException();
					}

					if(numChars <= 0)
						return -1;
				}
				return buf[curChar++];
			}

			public String nextLine()
			{
				BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
				String str = "";
				try
				{
					str = br.readLine();
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
				return str;
			}
			public int nextInt()
			{
				int c = read();

				while(isSpaceChar(c))
					c = read();

				int sgn = 1;

				if (c == '-')
				{
					sgn = -1;
					c = read();
				}

				int res = 0;
				do
				{
					if(c<'0'||c>'9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				}
				while (!isSpaceChar(c));

				return res * sgn;
			}

			public long nextLong()
			{
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-')
				{
					sgn = -1;
					c = read();
				}
				long res = 0;

				do
				{
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				}
				while (!isSpaceChar(c));
					return res * sgn;
			}

			public double nextDouble()
			{
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-')
				{
					sgn = -1;
					c = read();
				}
				double res = 0;
				while (!isSpaceChar(c) && c != '.')
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				}
				if (c == '.')
				{
					c = read();
					double m = 1;
					while (!isSpaceChar(c))
					{
						if (c == 'e' || c == 'E')
							return res * Math.pow(10, nextInt());
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						m /= 10;
						res += (c - '0') * m;
						c = read();
					}
				}
				return res * sgn;
			}

			public String readString()
			{
				int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do
				{
					res.appendCodePoint(c);
					c = read();
				}
				while (!isSpaceChar(c));

				return res.toString();
			}

			public boolean isSpaceChar(int c)
			{
				if (filter != null)
					return filter.isSpaceChar(c);
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}

			public String next()
			{
				return readString();
			}

			public interface SpaceCharFilter
			{
				public boolean isSpaceChar(int ch);
			}
		}

		static class Pair implements Comparable<Pair>
		{
			int a;
			int b;
			String str;
			public Pair(int a,int b)
			{
				this.a=a;
				this.b=b;
				str=min(a,b)+" "+max(a,b);
			}

			public int compareTo(Pair pair)
			{
				if(Integer.compare(a,pair.a)==0)
					return Integer.compare(b,pair.b);

				return Integer.compare(a,pair.a);
			}
		}

	}

import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
	public static long mod= (long) (1e9 +7);
	public static void main(String args[]) throws IOException
	{
		InputReader s= new InputReader(System.in);
		OutputStream outputStream= System.out;
		PrintWriter out= new PrintWriter(outputStream);
		int n= s.nextInt();
		int m= s.nextInt();
		int k= s.nextInt();
		int low=1,high=m;
		while(low<=high){
			int mid= (low+high)/2;
			int right= n-k;
			int left = k-1;
			int end= mid-1;
			int lower_right=0,lower_left=0,upper_right=0,upper_left=0;
			if(right>0){
				int start_right= end - (right - 1);
				if(start_right<=0){
					int temp= end*(end+1)/2;
					temp+=(right-end);
					lower_right=temp;
				}
				else{
					lower_right = ((end+start_right)*right)/2;
				}
				upper_right = right*mid;
			}
			if(left>0){
				int start_left= end - (left - 1);
				if(start_left<=0){
					int temp= end*(end+1)/2;
					temp+=(left-end);
					lower_left=temp;
				}
				else{
					lower_left = ((end+start_left)*left)/2;
				}
				upper_left = left*mid;
			}
			if((m-mid)>= lower_left+lower_right)
				low=mid+1;
			else
				high = mid-1;
		}
		out.println(high);
		out.close();
	}

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static long modulo(long x,long y,long p)
	{
		 long res = 1;
		 x = x % p;

	    while (y > 0)
	    {
	        if (y%2==1)
	            res = (res*x) % p;

	        y = y>>1;
	        x = (x*x) % p;
	    }
	    return res;
	}

	static void catalan_numbers(int n) {
		long catalan[]= new long[n+1];
	    catalan[1] = 1;
	    for (int i = 2; i <= n; i++) {
	        for (int j = 1; j <= i - 1; j++) {
	            catalan[i] = catalan[i] + ((catalan[j]) * catalan[i - j]);
	        }
	    }
	}

	static HashSet<Integer> primeFactors(int n)   // O(sqrt(n))
	{
	    // Print the number of 2s that divide n
		HashSet<Integer> arr= new HashSet<>();
	    while (n%2 == 0)
	    {
	        arr.add(2);
	        n = n/2;
	    }

	    // n must be odd at this point.  So we can skip one element (Note i = i +2)
	    for (int i = 3; i <= Math.sqrt(n); i = i+2)
	    {
	        // While i divides n, print i and divide n
	        while (n%i == 0)
	        {
	            arr.add(i);
	            n = n/i;
	        }
	    }
	    // This condition is to handle the case when n is a prime number
	    // greater than 2
	    if (n > 2)
	        arr.add(n);

	    return arr;
	}

	public static long expo(long a, long b){
		if (b==0)
	        return 1;
	    if (b==1)
	        return a;
	    if (b==2)
	        return a*a;

	    if (b%2==0){
	            return expo(expo(a,b/2),2);
	    }
	    else{
	        return a*expo(expo(a,(b-1)/2),2);
	    }
	}
	static class Pair implements Comparable<Pair>
	{
		int f;
		int s;
		int t;
		Pair(int ii, int cc, int dd)
		{
			f=ii;
			s=cc;
			t=dd;
		}

		public int compareTo(Pair o)
		{
			return Integer.compare(this.f, o.f);
		}

	}

	public static int[] sieve(int N){    // O(n*log(logn))
		int arr[]= new int[N+1];
		for(int i=2;i<=Math.sqrt(N);i++){
			if(arr[i]==0){
				for(int j= i*i;j<= N;j= j+i){
					arr[j]=1;
				}
			}
		}
		return arr;
		// All the i for which arr[i]==0 are prime numbers.
	}
	static long gcd(long a,long b){       // O(logn)
		if(b==0) return a;
		return gcd(b,a%b);
	}

	static final class InputReader{
        private final InputStream stream;
        private final byte[] buf=new byte[1024];
        private int curChar;
        private int Chars;
        public InputReader(InputStream stream){this.stream=stream;}
		private int read()throws IOException{
            if(curChar>=Chars){
                curChar=0;
                Chars=stream.read(buf);
                if(Chars<=0)
                    return -1;
            }
            return buf[curChar++];
        }
        public final int nextInt()throws IOException{return (int)nextLong();}
        public final long nextLong()throws IOException{
            int c=read();
            while(isSpaceChar(c)){
                c=read();
                if(c==-1) throw new IOException();
            }
            boolean negative=false;
            if(c=='-'){
                negative=true;
                c=read();
            }
            long res=0;
            do{
                if(c<'0'||c>'9')throw new InputMismatchException();
                res*=10;
                res+=(c-'0');
                c=read();
            }while(!isSpaceChar(c));
            return negative?(-res):(res);
        }
        public final int[] nextIntBrray(int size)throws IOException{
            int[] arr=new int[size];
            for(int i=0;i<size;i++)arr[i]=nextInt();
            return arr;
        }
        public final String next()throws IOException{
            int c=read();
            while(isSpaceChar(c))c=read();
            StringBuilder res=new StringBuilder();
            do{
                res.append((char)c);
                c=read();
            }while(!isSpaceChar(c));
            return res.toString();
        }
        public final String nextLine()throws IOException{
            int c=read();
            while(isSpaceChar(c))c=read();
            StringBuilder res=new StringBuilder();
            do{
                res.append((char)c);
                c=read();
            }while(c!='\n'&&c!=-1);
            return res.toString();
        }
        private boolean isSpaceChar(int c){
            return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.math.BigInteger;

import javax.management.Query;

import com.sun.corba.se.impl.orbutil.closure.Constant;
import com.sun.org.apache.bcel.internal.generic.SWAP;

public class fstclass {
	public static final int N = 212345;
	static int[][] d = new int[100][100];
	public static void main(String[] args) {
		InputStream inputStream = System.in;
        InputReader in = new InputReader(inputStream);
        long n, m, i, j;
        n = in.nextInt();
        m = in.nextInt();
        long k = in.nextInt();
        m -= n;
        long l = 0, r = m;
        while(r - l > 1) {
        	long md = (l + r) >> 1;
        	long cnt = 0;
        	if(md >= k) {
        		cnt += (md - k + 1 + md) * k / 2;
        	}
        	else {
        		cnt += md * (md + 1) / 2;
        	}
        	if(n - k <= md) {
        		cnt += (md - (n - k + 1) + 1 + md) * (n - k + 1) / 2;
        		cnt -= md;
        	}
        	else {
        		cnt += md * (md + 1) / 2;
        		cnt -= md;
        	}
        	if(cnt > m)
        		r = md;
        	else
        		l = md;
        }
        System.out.print(l + 1);
	}
	/*public static int kth(int t, int k) {
		int m = 0;
		for(int i = 19; i >= 0; i --) {
			if(((1 << i) & k) != 0) {
				m = Math.max(m, mx[t][i]);
				t = p[t][i];
			}
		}
		return m;
	}*/

	/*public static int lca(int a, int b) {
		if(upper(a, b)) return a;
		if(upper(b, a)) return b;
		for(int i = 19; i >= 0; i --) {
			if(!upper(p[a][i], b)) {
				a = p[a][i];
			}
		}
		return p[a][0];
	}*/
/*	public static boolean upper(int a, int b) {
		return tin[a] <= tin[b] && tout[a] >= tout[b];
	}
	public static void dfs(int t, int f, int d, int s) {
		p[t][0] = f;
		mx[t][0] = d;
		dp[t] = s;
		for(int i = 1; i <= 19; i ++) {
			p[t][i] = p[p[t][i - 1]][i - 1];
			mx[t][i] = Math.max(mx[p[t][i - 1]][i - 1], mx[t][i - 1]);
		}
		tin[t] = +timer;
		for(int i = 0; i < v[t].size(); i ++) {
			int to = v[t].get(i);
			if(to != f) {
				dfs(to, t, vxy[t].get(i), s + 1);
			}
		}
		tout[t] = ++timer;
	}
	public static int find(int parentd) {*/
	/*	if(parent[parentd] == parentd)
			return parentd;
		return parent[parentd] = find(parent[parentd]);
	}*/
	/*public static void merg(int l, int r) {
		if(l >= r)
			return ;
		int m = (l + r) / 2;
		merg(l,  m);
		merg(m + 1, r);
		int p1 = l, p2 = m + 1, p = l;
		while(p1 <= m && p2 <= r) {
			if(a[p1] <= a[p2]) {
				a1[p] = a[p1];
				id1[p ++] = id[p1 ++];
			}
			else {
				a1[p] = a[p2];
				id1[p ++] = id[p2 ++];
			}
		}
		while(p1 <= m) {
			a1[p] = a[p1];
			id1[p ++] = id[p1 ++];
		}
		while(p2 <= r) {
			a1[p] = a[p2];
			id1[p ++] = id[p2 ++];
		}
		for(int i = l; i <= r; i ++) {
			a[i] = a1[i];
			id[i] = id1[i];
		}
	}
	*/
	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B {
	static long sum[];
	static long idxx;

	public static int binarysearch(long x) {
		int low = 0;
		int high = 100000;
		int ans = -1;
		while (low <= high) {
			int mid = (high + low) / 2;
			if (sum[mid] > x)
				high = mid - 1;
			if (sum[mid] <= x) {
				low = mid + 1;
				ans = mid;
			}
		}
		return ans == -1 ? 0 : ans;

	}

	public static long binarysearch2(long m, long n, long k) {
		long low = 0;
		long high = 100000;
		long ans = -1;
		while (low <= high) {
			long mid = (high + low) / 2;
			long end = Math.max(mid - - Math.min(n - k + 1, k), 0);
			long sumtaken = mid * (mid + 1) - mid - (end * (end + 1) / 2);
			if (sumtaken > m)
				high = mid - 1;
			if (sumtaken <= m) {
				low = mid + 1;
				ans = sumtaken;
				idxx = mid;
			}
		}
		return ans == -1 ? 0 : ans;

	}

	public static long ceil(long a, long b) {
		long ans = a / b;
		if (a % b != 0)
			ans++;
		return ans;
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		sum = new long[100000];
		for (int i = 1; i < 100000; i++) {
			sum[i] = ((long) i) * (i + 1) / 2;

		}
		long n = in.nextLong();
		long m = in.nextLong();
		long k = in.nextLong();
		m -= n;
		long ans = 1;
		if (k == 1 || k == n) {
			long idx = binarysearch(m);
			if (idx > n) {
				ans += n;
				m -= sum[(int) n];
				ans += m / n;
			} else
				ans += idx;
		} else {
			long maxside = Math.max(n - k + 1, k);
			long num = maxside - Math.min(n - k + 1, k);
			long sumtaken = maxside * (maxside + 1) - maxside
					- (num * (num + 1) / 2);
			//System.err.println(sumtaken + " " + maxside + " " + num);
			if (sumtaken <= m) {
				ans += maxside;
				m -= sumtaken;
				ans += m / n;
			} else {
				idxx = 0;
				long summ = binarysearch2(m, n, k);
				ans += idxx;
				m -= summ;
				ans += m / n;
			}

		}
		System.out.println(ans);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskCF393D2B solver = new TaskCF393D2B();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskCF393D2B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int k = in.nextInt();

            int min = 1;
            int max = m - n + 1;

            int maxPossible = 0;

            while (min <= max) {
                int mid = (min + max) / 2;

                if (possible(mid, n, m, k)) {
                    maxPossible = Math.max(maxPossible, mid);
                    min = mid + 1;
                } else {
                    max = mid - 1;
                }
            }
            out.println(maxPossible);
        }

        private boolean possible(long mid, long n, long m, long k) {
            return (m >= mid + sum(mid, k) + sum(mid, n - k + 1)) && ((mid * n) >= m);
        }

        private long sum(long a, long k) {
            long s = (a - 1) * a / 2;

            if (k >= a && (k - a) % 2 == 0) {
                //s += 3 * (k - a) / 2;
            } else if (k >= a) {
                //s += (k - a - 1)/2 * 3 + 2;
            } else if (k < a) {
                s -= (a - k) * (a - k + 1) / 2;
            }
            return s;
        }

    }
}

	import java.util.Scanner;
	import java.io.*;
	import java.util.*;
	import java.math.*;
	import java.lang.*;
	import static java.lang.Math.*;

	public class TestClass implements Runnable
	{
		public static void main(String args[])
		{
			new Thread(null, new TestClass(),"TESTCLASS",1<<26).start();
		}
		public void run()
		{
			//Scanner scan=new Scanner(System.in);
			InputReader hb=new InputReader(System.in);
			PrintWriter w=new PrintWriter(System.out);

			int n=hb.nextInt();
			int m=hb.nextInt();
			int k=hb.nextInt();

			int start=1;
			int end=m;
			long count=0;
			int x=0;
			int max=0;
			while(start<end)
			{
				int left=k-1;
				int right=n-k;

				x=start + (end-start)/2;
				count=x;
				//w.println(start+" "+end);
				//w.print(count+" ");
				if(left>x-1)
					count+= x*(x-1)/2  +  left  -  (x-1);
				else
					count+= left*(x-1 + x-left)/2;
				//w.print(count+" ");
				if(right>x-1)
					count+= x*(x-1)/2  +  right  -  (x-1);
				else
					count+= right*(x-1 + x-right)/2;
				//w.println(count);
				if(count>m)
					end=x;
				else
				{
					start=x+1;
					if(x>max)
						max=x;
				}
				if(count==m)
					break;
			}
			if(n==1 && m==1 && k==1)
				max=1;
			w.print(max);
			w.close();
		}

		private void shuffle(char[] arr)
		{
			Random ran = new Random();
			for (int i = 0; i < arr.length; i++) {
				int i1 = ran.nextInt(arr.length);
				int i2 = ran.nextInt(arr.length);

				char temp = arr[i1];
				arr[i1] = arr[i2];
				arr[i2] = temp;
			}
		}
		static class InputReader
		{
			private InputStream stream;
			private byte[] buf = new byte[1024];
			private int curChar;
			private int numChars;
			private SpaceCharFilter filter;

			public InputReader(InputStream stream)
			{
				this.stream = stream;
			}

			public int read()
			{
				if (numChars==-1)
					throw new InputMismatchException();

				if (curChar >= numChars)
				{
					curChar = 0;
					try
					{
						numChars = stream.read(buf);
					}
					catch (IOException e)
					{
						throw new InputMismatchException();
					}

					if(numChars <= 0)
						return -1;
				}
				return buf[curChar++];
			}

			public String nextLine()
			{
				BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
				String str = "";
				try
				{
					str = br.readLine();
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
				return str;
			}
			public int nextInt()
			{
				int c = read();

				while(isSpaceChar(c))
					c = read();

				int sgn = 1;

				if (c == '-')
				{
					sgn = -1;
					c = read();
				}

				int res = 0;
				do
				{
					if(c<'0'||c>'9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				}
				while (!isSpaceChar(c));

				return res * sgn;
			}

			public long nextLong()
			{
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-')
				{
					sgn = -1;
					c = read();
				}
				long res = 0;

				do
				{
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				}
				while (!isSpaceChar(c));
					return res * sgn;
			}

			public double nextDouble()
			{
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-')
				{
					sgn = -1;
					c = read();
				}
				double res = 0;
				while (!isSpaceChar(c) && c != '.')
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				}
				if (c == '.')
				{
					c = read();
					double m = 1;
					while (!isSpaceChar(c))
					{
						if (c == 'e' || c == 'E')
							return res * Math.pow(10, nextInt());
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						m /= 10;
						res += (c - '0') * m;
						c = read();
					}
				}
				return res * sgn;
			}

			public String readString()
			{
				int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do
				{
					res.appendCodePoint(c);
					c = read();
				}
				while (!isSpaceChar(c));

				return res.toString();
			}

			public boolean isSpaceChar(int c)
			{
				if (filter != null)
					return filter.isSpaceChar(c);
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}

			public String next()
			{
				return readString();
			}

			public interface SpaceCharFilter
			{
				public boolean isSpaceChar(int ch);
			}
		}

		static class Pair implements Comparable<Pair>
		{
			int a;
			int b;
			String str;
			public Pair(int a,int b)
			{
				this.a=a;
				this.b=b;
				str=min(a,b)+" "+max(a,b);
			}

			public int compareTo(Pair pair)
			{
				if(Integer.compare(a,pair.a)==0)
					return Integer.compare(b,pair.b);

				return Integer.compare(a,pair.a);
			}
		}

	}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class VCFB{

	void solve()
	{
		long n = ni();
		long m = ni();
		long k = ni();
		long l = 1, r = m;
		long a = k, b = n-k+1;
		long mid = 0;
		while(l<=r)
		{
			mid = l + (r-l)/2;
			long f = mid*(mid+1)/2;
			long g = mid>a ? (mid-a)*(mid-a+1)/2 : 0;
			long h = mid>b ? (mid-b)*(mid-b+1)/2 : 0;
			long val = 2*f-g-h-mid;
			if(val==m)
				break;
			if(val>m)
				r = mid-1;
			else
			{
				if(l==mid)
					l = mid+1;
				else
					l = mid;
			}
		}
		out.println(mid);
	}

	public static void main(String[] args){new VCFB().start();}

	private byte[] bufferArray = new byte[1024];
	private int bufLength = 0;
	private int bufCurrent = 0;
	InputStream inputStream;
	PrintWriter out;

	void start()
	{
		inputStream = System.in;
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	int nextByte()
	{
		if(bufLength==-1)
			throw new InputMismatchException();
		if(bufCurrent>=bufLength)
		{
			bufCurrent = 0;
			try
			{bufLength = inputStream.read(bufferArray);}
			catch(IOException e)
			{ throw new InputMismatchException();}
			if(bufLength<=0)
				return -1;
		}
		return bufferArray[bufCurrent++];
	}

	boolean isSpaceChar(int x)
	{return (x<33 || x>126);}

	boolean isDigit(int x)
	{return (x>='0' && x<='9');}

	int nextNonSpace()
	{
		int x;
		while((x=nextByte())!=-1 && isSpaceChar(x));
		return x;
	}

	int ni()
	{
		int ans = 0;
		int sign = 1;
		int x = nextNonSpace();
		if(x=='-')
		{
			sign = -1;
			x = nextByte();
		}
		while(!isSpaceChar(x))
		{
			if(isDigit(x))
			{
				ans = ans*10 + x -'0';
				x = nextByte();
			}
			else
				throw new InputMismatchException();
		}
		return sign*ans;
	}

	long nl()
	{
		long ans = 0;
		long sign = 1;
		int x = nextNonSpace();
		if(x=='-')
		{
			sign = -1;
			x = nextByte();
		}
		while(!isSpaceChar(x))
		{
			if(isDigit(x))
			{
				ans = ans*10 + x -'0';
				x = nextByte();
			}
			else
				throw new InputMismatchException();
		}
		return sign*ans;
	}

	String ns()
	{
		StringBuilder sb = new StringBuilder();
		int x = nextNonSpace();
		while(!isSpaceChar(x))
		{
			sb.append((char)x);
			x = nextByte();
		}
		return sb.toString();
	}

	String nL()
	{
		StringBuilder sb = new StringBuilder();
		int x = nextNonSpace();
		while(x==32 || !isSpaceChar(x))
		{
			sb.append((char)x);
			x = nextByte();
		}
		return sb.toString();
	}

	char nc()
	{ return (char)nextNonSpace();}

	double nd()
	{ return (double)Double.parseDouble(ns()); }

	char[] ca()
	{ return ns().toCharArray();}

	char[] ca(int n)
	{
		char[] ans = new char[n];
		int p =0;
		int x = nextNonSpace();
		while(p<n)
		{
			ans[p++] = (char)x;
			x = nextByte();
		}
		return ans;
	}

	int[] ia(int n)
	{
		int[] ans = new int[n];
		for(int i=0;i<n;i++)
			ans[i]=ni();
		return ans;
	}

	long[] la(int n)
	{
		long[] ans = new long[n];
		for(int i=0;i<n;i++)
			ans[i] = nl();
		return ans;
	}

}

import java.util.*;
import java.io.*;

public class Solution{

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static boolean check(long n, long m, long k, long p){
        long l1 = k-1;
        long l2 = n-k;

        long ans = m*l1-(l1*(l1+1))/2;
        ans += m*l2-(l2*(l2+1))/2;

        return (ans<=p);
    }

    static long bs(long n, long m, long k){
        long l=1, r=m+1, mid=0, ans=1;
        while(l<=r){
            mid = (l+r)/2;
            if(check(n, mid, k, m-mid)){
                ans = Math.max(ans, mid);
                l = mid+1;
            }else{
                r = mid-1;
            }
        }

        return ans;
    }

    public static void main (String[] args) throws IOException {
        FastReader sc = new FastReader();
        long n = sc.nextLong();
        long m = sc.nextLong();
        long k = sc.nextLong();

        long res = bs(n, m, k);
        System.out.println(res);
    }
}

import java.io.*;
import java.util.*;
import java.lang.*;

public final class Main {

    private int getNumberOfDays(int m) {
        return (int) (28 + (m + Math.floor(m / 8)) % 2 + 2 % m + 2 * Math.floor(1 / m));
    }

    private void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();

        boolean right = false, left = false;
        if (k >= n / 2){
            right = true;
        }else{
            left = true;
        }

        int res = 0;
        m -= n;
        res++;
        if (m > 0){
            res++;
            m--;
        }
        boolean side = false;
        int add;
        if (k != 1 && k != n){
            add = 3;
        }else{
            side = true;
            add = 2;
        }

        int count = 0;
        if (left){
            count = k - 1;
        }else if (right){
            count = n - k;
        }

        while (m > 0){
            m -= add;
            if (m >= 0){
                res++;
            }else{
                out.print(res);
                return;
            }

            if (!side)
                if (left){
                    if (count == 1){
                        side = true;
                    }
                }else if (right){
                    if (count == n){
                        side = true;
                    }
                }

            if (!side){
                add += 2;
            }else{
                add += 1;
            }

            if (right){
                count++;
            }else if (left){
                count--;
            }
        }

        out.print(res);
    }

    //    -------------I/O-------------    \\
    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    public static void main(String[] args) {
        new Main().runIO();
    }

    private FScanner in;
    private PrintWriter out;

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;

public class CF
{

	public static void main (String[] args) throws IOException
	{

		Reader.init(System.in);

		int n=Reader.nextInt();
		int m=(Reader.nextInt()-n);
		int k=Reader.nextInt()-1;

		long ans=0;

		if(m>=1)
		{
			ans=1;m--;
		}

		int left=k,right=k;

		if(k-1>-1)
			left=k-1;

		if(k+1<n)
			right=k+1;

		while(m>0 && left!=0 && right!=n-1) {

			int xl=Math.abs(k-left);
			int xr=Math.abs(k-right);

			m-=(xl+xr);

			if(m>0)
			{
				m--;ans++;
			}

			if(left-1>-1)
				left--;

			if(right+1<n)
				right++;

		}

		if(m>0) {

			ans+=m/n;
		}
		System.out.println(ans+1);

	}
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static long nextLong() throws IOException{

    	return Long.parseLong( next() );
    }

}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main30 {

	public static void main(String[] args) throws IOException
	{
		BufferedReader in;
		File file = new File("in");
		StringBuilder out = new StringBuilder("");
		if (file.exists()) {
			in = new BufferedReader(new FileReader(file));
		} else {
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		String lines[];
		int n, m, k;
		lines = in.readLine().split("\\s+");
		n = Integer.parseInt(lines[0]);
		m = Integer.parseInt(lines[1]);
		k = Integer.parseInt(lines[2]);
		int s = m-n;

		int result = 1;
		if ( s != 0)
		{
			int left = k -1 ;
			int right = n - k;
			int min = Math.min(left, right);
			int max = Math.max(left, right);
			int c = (int)Math.sqrt(s);
			int c1 = Math.min(min+1, c);

			result += c1;
			s -= c1*c1;
			//System.out.println(c1);
			if ( s != 0)
			{
				int v = 2*c1-1;
				int r = n - v;
				for( int i = v+1, j = 1; j <= r; i++, j++  )
				{
					if ( s - i >= 0 )
					{
						s -= i;
						result++;
					}
				}

				result += s/n;
			}
		}
		System.out.println(result);

	}

	public static int[] readInts(String line)
	{
		String lines[] = line.split("\\s+");
		int result[] = new int[lines.length];
		for( int i = 0; i < lines.length ; i++ )
		{
			result[i] = Integer.parseInt(lines[i]);
		}
		return result;
	}
}

import java.util.*;

import javax.naming.CommunicationException;

public class FrodoAndPillows {

	public boolean check(int frodoVal, int frodoBed, int numHobbits, int numPillows)
	{
		int leftPointer = frodoBed - 1;
		int rightPointer = frodoBed + 1;

		long sum = frodoVal;
		int lastVal = frodoVal;

		while(leftPointer>=1 || rightPointer<=numHobbits)
		{
			lastVal = lastVal - 1;
			if(lastVal <= 0)
				return false;

			if(leftPointer>=1)
			{
				leftPointer -= 1;
				sum += lastVal;
			}
			if(rightPointer<=numHobbits)
			{
				rightPointer += 1;
				sum += lastVal;
			}
		}
		if(sum <= numPillows)
			return true;
		else
			return false;
	}

	public int bsearch(int start, int end, int numHobbits, int numPillows, int frodoBed)
	{
		if(start == end)
			return start;

		else
		{
			int mid = start + (end-start)/2;

			if(check(mid, frodoBed, numHobbits, numPillows))
			{
				if(mid!= start)
					return bsearch(mid, end, numHobbits, numPillows, frodoBed);
				else
				{
					if(check(mid+1, frodoBed, numHobbits, numPillows))
						return mid+1;
					else
						return mid;
				}
			}
			else
				return bsearch(start, mid-1, numHobbits, numPillows, frodoBed);
		}
	}

	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int numHobbits = sc.nextInt();
		int numPillows = sc.nextInt();
		int frodoBed = sc.nextInt();
		int frodoValue = numPillows - (numHobbits - 1);

		FrodoAndPillows obj = new FrodoAndPillows();
		System.out.println(obj.bsearch(1, frodoValue, numHobbits, numPillows, frodoBed));
	}
}

import java.io.*;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.net.ssl.SSLContext;

public class Main
{
   static long mod=(long)(1e+9) + 7;
   static int[] sieve;
   static int ans=1;
   static ArrayList<Integer> primes;

   public static boolean check(int index,int p,int available,int n)
   {
	   int left=index;
	   int right=n-1-index;

	   int total=0;

	   if(left<=p-1)
	    total+=((2*p-1-left)*left)/2;
	   else total+=((p-1)*p/2)+left-p+1;

	   if(right<=p-1)
		  total+=((2*p-1-right)*right)/2;
	   else total+=((p-1)*p/2)+right-p+1;

	   total+=p;

	   if(total>available) return false;
	   ans=Math.max(ans, p);
	   return true;

   }

   public static void main(String[] args) throws java.lang.Exception
   {
	     fast s = new fast();
	     PrintWriter out=new PrintWriter(System.out);
	     Scanner sc=new Scanner(System.in);
	     StringBuilder fans = new StringBuilder();

	     int n=s.nextInt();
	     int p=s.nextInt();
	     int k=s.nextInt();

	     int l=1;
	     int r=p;

	     while(l<=r)
	     {
	    	 int mid=(l+r)>>1;

	         if(check(k-1,mid,p,n))
	        	 l=mid+1;
	         else
	        	 r=mid-1;
	     }

	     System.out.println(ans);
   }

   static class fast {
		private InputStream i;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public static boolean next_permutation(int a[])
		   {
			   int i=0,j=0;int index=-1;
			   int n=a.length;

			   for(i=0;i<n-1;i++)
				   if(a[i]<a[i+1]) index=i;

			   if(index==-1) return false;
			   i=index;

			   for(j=i+1;j<n && a[i]<a[j];j++);

			   int temp=a[i];
			   a[i]=a[j-1];
			   a[j-1]=temp;

			   for(int p=i+1,q=n-1;p<q;p++,q--)
			   {
				   temp=a[p];
				   a[p]=a[q];
				   a[q]=temp;
			   }

			   return true;
		   }

		public static void division(char ch[],int divisor)
		   {
			   int div=Character.getNumericValue(ch[0]); int mul=10;int remainder=0;
			   StringBuilder quotient=new StringBuilder("");
			   for(int i=1;i<ch.length;i++)
			   {
				   div=div*mul+Character.getNumericValue(ch[i]);
				   if(div<divisor) {quotient.append("0");continue;}
				   quotient.append(div/divisor);
				   div=div%divisor;mul=10;

			   }
			   remainder=div;
			   while(quotient.charAt(0)=='0')quotient.deleteCharAt(0);
			   System.out.println(quotient+" "+remainder);
		   }

		public static void sieve(int size)
		{
			sieve=new int[size+1];
			primes=new ArrayList<Integer>();
			sieve[1]=1;
			for(int i=2;i<=Math.sqrt(size);i++)
			{
				if(sieve[i]==0)
				 {
					for(int j=i*i;j<size;j+=i) sieve[j]=1;
				 }
			}

			for(int i=2;i<=size;i++)
			{
				if(sieve[i]==0) primes.add(i);
			}
		}
		public static long pow(long n, long b, long MOD)
		   {
		       long x=1;long y=n;
		       while(b > 0)
		       {
		           if(b%2 == 1)
		           {
		               x=x*y;
		               if(x>MOD) x=x%(MOD);
		           }
		           y = y*y;
		           if(y>MOD) y=y%(MOD);
		           b >>= 1;
		       }
		       return x;
		   }

		 public static int upper(Integer[] a,int start,int end,int key)
		 {
			   int mid=(start+end)>>1;
			   if(start==end && a[mid]<key) {return -1;}
			   if(start>end) return -1;

			   if(a[mid]>=key && (((mid-1)>=0 && a[mid-1]<key) || (mid-1)==0)) return mid;
			   else if(a[mid]== key && (mid-1)>=0 && a[mid-1]==key) return lower(a,start,mid-1,key);
			   else if(key>a[mid]) return lower(a,mid+1,end,key);
			   else return lower(a,start,mid-1,key);
		}

		 public static int lower(Integer a[],int start,int end,int key)
		 {
			   int mid=(start+end)>>1;
			   if(start==end && a[mid]>key) {return -1;}
			   if(start>end) return -1;

			   if(a[mid]<=key && (((mid+1)<a.length && a[mid+1]>key) || (mid+1)==a.length)) return mid;
			   else if(a[mid]== key && (mid+1)<a.length && a[mid+1]==key) return upper(a,mid+1,end,key);
			   else if(key>=a[mid]) return upper(a,mid+1,end,key);
			   else return upper(a,start,mid-1,key);
		}

		public int gcd(int a,int b)
		{
			if(a==0) return b;
			return gcd(b%a,a);
		}
		public fast() {
			this(System.in);
		}
		public fast(InputStream is) {
			i = is;
		}
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = i.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		public String nextString() {
     		int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) throws IOException {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = scan.nextInt(), m = scan.nextInt(), k = scan.nextInt();
		int c = m/n;
		int extra = m%n;
		if(k == 1 || k == n){// sleeps on the end
			if(extra > 2 && n > 3) c += 2; // we have extra to give to frodo and his one neighbor and he can take one from a sleeper further down
			else if(extra > 0) c++; // we have at least one extra pillow for frodo
			else if(n > 2)c++; // we can take one from a sleeper further down
		}
		else if(k > 1 && k < n){// sleeps in the middle
			if(extra > 3) c += 2; // we can give pillows to frodo and his neighbors and take a pillow from a different sleeper
			else if(extra > 0) c++; // we have an extra pillow for frodo
		}
		out.println(c);
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

		public int nextInt() {return Integer.parseInt(next());}

		public long nextLong() {return Long.parseLong(next());}

		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.Arrays;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
public class B {
	public static void main(String[] args)throws Throwable {
		MyScanner sc=new MyScanner();
		PrintWriter pw=new PrintWriter(System.out,true);

		int n=sc.nextInt();
		int m=sc.nextInt()-n;
		int k=sc.nextInt();
		int ans=1;
		if(k==1 || k==n){
			for(int i=1;m-i>=0;i++){
				m-=i;
				ans++;
			}
		}else{
			for(int i=1;m-i>=0;i+=2){
				m-=i;
				ans++;
			}
		}

		pw.println(ans);
		pw.flush();
		pw.close();
	}

	static class MyScanner {
	      BufferedReader br;
	      StringTokenizer st;

	      public MyScanner() {
	         br = new BufferedReader(new InputStreamReader(System.in));
	      }

	      String next() {
	          while (st == null || !st.hasMoreElements()) {
	              try {
	                  st = new StringTokenizer(br.readLine());
	              } catch (IOException e) {
	                  e.printStackTrace();
	              }
	          }
	          return st.nextToken();
	      }

	      int nextInt() {
	          return Integer.parseInt(next());
	      }

	      long nextLong() {
	          return Long.parseLong(next());
	      }

	      double nextDouble() {
	          return Double.parseDouble(next());
	      }

	      String nextLine(){
	          String str = "";
		  try {
		     str = br.readLine();
		  } catch (IOException e) {
		     e.printStackTrace();
		  }
		  return str;
	      }

	   }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) throws IOException{
		  	FastScanner sc = new FastScanner();
			PrintWriter out = new PrintWriter(System.out);
			long n = sc.nextLong();
			long m = sc.nextLong();
			long k = sc.nextLong();
			long lo =1;long hi =(long) 1e18;
			long ans =0 ;
			long mid=0;
			for(int i=1;i<=77;i++){
				mid= (lo+hi)/2;
				if(can(mid,n,m,k)){
					ans=mid;
					lo=mid+1;
				}else
					hi=mid-1;
			}
			System.out.println(ans);

	}
	public static boolean can(long x,long n , long m , long k){
		long l1 =n-k;
		long l2 = k-1;
		long sum=0L;
		if(x-1>=l1){
			long t = x-l1;
			sum+=x*(x-1)/2 - t*(t-1)/2;

		}
		if(x-1<l1){
			sum+=l1-x+1;

			sum+=x*(x-1)/2;
		}

		if(x-1>=l2){
			long t = x-l2;
			sum+=x*(x-1)/2 - t*(t-1)/2;

		}
		if(x-1<l2){
			sum+=l2-x+1;

			sum+=x*(x-1)/2;
		}
		return sum+x<=m;
	}

	private static int log2(int n) {
		int c= 0 ;
		while(n>0){
			n/=2;
			c++;
		}
		return c;
	}

	static void shuffle(int[] a)
	{
		int n = a.length;
		for(int i = 0; i < n; ++i)
		{
			int r = i + (int)(Math.random() * (n - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		}
	}

	static void generate(int[] p, int L, int R) {
		  if (L == R) {

		  }else {
		    for (int i = L; i <= R; i++) {
		    	int tmp = p[L]; p[L] = p[i]; p[i] = tmp;//swap  do
		      generate(p, L+1, R);//recurse
		      tmp = p[L]; p[L] = p[i]; p[i] = tmp;//unswap  undo

		    }
		  }
		}

}

	  class point implements Comparable{
		int x ;int y ;
		point(int x ,int y){
			this.x=x;
			this.y=y;
		}
		@Override
		public int compareTo(Object arg0) {
			point p = (point)arg0;
			// TODO Auto-generated method stub
			return -p.y+this.y;

		}

	}

class FastScanner {

    BufferedReader br;
    StringTokenizer st;

    public FastScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    public FastScanner(String s) {
        try {
            br = new BufferedReader(new FileReader(s));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    String nextToken() {
        while (st == null || !st.hasMoreElements()) {
            try {

                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(nextToken());
    }

    long nextLong() {
        return Long.parseLong(nextToken());
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }

}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Temp {
	static int imax = Integer.MAX_VALUE, imin = Integer.MIN_VALUE;
	static long lmax = Long.MAX_VALUE, lmin = Long.MIN_VALUE;
	static long mod = (long) 1e9 + 7;

	public static void main(String[] args) throws java.lang.Exception {
		// File file=new File("C:\\Users\\EagleEye\\Desktop\\input.txt");
		// File file1=new File("C:\\Users\\EagleEye\\Desktop\\output.txt");
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		// int test=in.ni();
		int test = 1;
		int i = 0, j = 0;
		while (test-- > 0) {
			int n = in.ni();
			int m = in.ni();
			int k = in.ni();
			// n -= m;
			int first = 0;
			int last = n;
			int sum = n;
			int idx = 1;
			while (sum <= m) {
				if (idx - 1 > Math.max(last - k, k - 1)) {
					System.out.println(sum);
					int tmp = m - sum;
					// tmp=tmp/n;
					idx += tmp / n;
					if (tmp % n != 0)
						idx++;
					break;
				}
				sum++;
				sum += Math.min(idx - 1, last - k);
				sum += Math.min(idx - 1, k - 1);
				idx++;

			}
			out.println(idx - 1);
		}
		out.close();
	}

	static class Pair {
		int x, y;

		Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}

		public String toString() {
			return x + " " + y;
		}
	}

	static void print(int arr[], int len) {
		for (int i = 0; i < len; i++)
			System.out.print(arr[i] + " ");
		System.out.println();
	}

	static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int ni() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c & 15;
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nl() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c & 15;
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String ns() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public char[] ncs() {
			return ns().toCharArray();
		}

		public String nLine() {
			int c = read();
			// while (c != '\n' && c != '\r' && c != '\t' && c != -1)
			// c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (c != '\n' && c != '\r' && c != '\t' && c != -1);
			return res.toString();
		}

		public static boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	}

}

//package contest760;

import java.io.*;
import java.util.*;

/**
 * Created by Brijesh on 23-01-2017.
 */
public class Main {
    static int e09$7=1000000007;
    static double e_06=0.000001;
    static long INF=1000000000000000L;
    static final String[] EMPTY_ARRAY = new String[0];
    static String d_loc="/home/brijesh/Downloads/";
    static String d_loc2="C:\\Users\\Brijesh\\Downloads\\";
    public static void main (String[] args) throws Exception {
        //BufferedReader br=new BufferedReader(new FileReader(d_loc+"A-small-attempt0.in"));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        StringBuilder sb = new StringBuilder();
        st=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        int k=Integer.parseInt(st.nextToken());
        if (m==n) System.out.println(1);
        else {
            long k2=k,n2=n;
            long sum=(-k2*k2) + k2 + (n2*k2) - ((n2*(n2+1))/2);
            long nx=m-sum;
            //System.out.println(sum+ " "+nx);
            System.out.println(nx/n);
        }

        System.exit(0);
    }
}

import java.util.*;
import java.io.*;

public class File {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // Basically, we want to make k into a peak of a mountain.

        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();

        // n hobbits: H H H H
        // m pillows
        // kth is Frodo
        // H F H H
        // 2 3 2 1

        // Only one, gets all pillows.
        if (n == 1) {
            System.out.println(m);
            return;
        }

        // Try every possible height.
        int lo = m / n;
        int hi = m - (n - 1);
        int max = 1;

        while (lo <= hi) {
            int mid = lo + (hi - lo) / 2;

            if (isValid(mid, k, n, m)) {
                max = Math.max(max, mid);
                lo = mid + 1;
            }
            else {
                hi = mid - 1;
            }
        }

        System.out.println(max);
    }

    public static boolean isValid(long height, long k, long n, long m) {
        // height at k is valid as long as
        // the number of pillows, m, is within the min and max pillows
        // needed.

        long toLeft = k - 1;
        long toRight = n - k;

        long minLeft = 0;
        long minRight = 0;
        long maxLeft = 0;
        long maxRight = 0;

        if (height > 2) {
            if (toLeft > 0) {
                long totalLeft = (height-1) * (height) / 2;
                long cuttOff = Math.max((height - 1) - toLeft, 0);
                totalLeft -= (cuttOff * (cuttOff + 1) / 2);
                minLeft += totalLeft;
            }
            if (toRight > 0) {
                long totalRight = (height-1) * (height) / 2;
                long cuttOff = Math.max((height - 1) - toRight, 0);
                totalRight -= (cuttOff * (cuttOff + 1) / 2);
                minRight += totalRight;
            }
        }

        maxLeft = height * toLeft + (toLeft * (toLeft + 1) / 2);
        maxRight = height * toRight + (toRight * (toRight + 1) / 2);

        return (minLeft + minRight) <= (m - height) && (m - height) <= (maxLeft + maxRight);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author zodiacLeo
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        FastPrinter out = new FastPrinter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB
    {
        public void solve(int testNumber, FastScanner in, FastPrinter out)
        {
            long n = in.nextInt();
            long p = in.nextInt();
            long pos = in.nextInt();
            long a = pos - 1;
            long b = n - pos;

            p -= n;
            long A = a * (a + 1);
            A /= 2;
            long B = b * (b + 1);
            B /= 2;

            long count = 1;
            if (p > 0)
            {
                count += (p + B + A) / (a + b + 1);
            }
            out.println(count);

        }

    }

    static class FastScanner
    {
        public BufferedReader br;
        public StringTokenizer st;

        public FastScanner(InputStream is)
        {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        public String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                String s = null;
                try
                {
                    s = br.readLine();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

    }

    static class FastPrinter extends PrintWriter
    {
        public FastPrinter(OutputStream out)
        {
            super(out);
        }

        public FastPrinter(Writer out)
        {
            super(out);
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Scanner;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author David Wu
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            TaskB.FastScanner sc = new TaskB.FastScanner();
            long n = sc.nextLong();
            long m = sc.nextLong();
            long k = sc.nextLong();
            long ans = 0;
            if (n == m) {
                out.print(1);
                System.exit(0);
            }

            m -= n + 1;
            ans = 2;
            long l = Math.max(k - 1, 1), r = Math.min(k + 1, n);

            while ((l > 1 || r < n) && m >= (r - l + 1)) {
                m -= r - l + 1;
                ans++;

                if (l > 1) {
                    l--;
                }

                if (r < n) {
                    r++;
                }
            }

            long len = r - l + 1;
            ans += m / len;

            out.println(ans);

        }

        public static class FastScanner {
            BufferedReader br;
            StringTokenizer st;

            public FastScanner() {
                br = new BufferedReader(new InputStreamReader(System.in));
            }

            String next() {
                while (st == null || !st.hasMoreElements()) {
                    try {
                        st = new StringTokenizer(br.readLine());
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                return st.nextToken();
            }

            long nextLong() {
                return Long.parseLong(next());
            }

        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author zodiacLeo
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int n = in.nextInt();
            int m = in.nextInt();
            int k = in.nextInt();

            if (n == 1)
            {
                out.println(m);
                return;
            }

            int result = n;
            int used = n * (n + 1) / 2;
            int left = m - used;
            int nn = n - 1;
            if (left < 0)
            {
                while (left < 0)
                {
                    result -= 1;
                    left += nn;
                    nn -= 1;
                }
                out.println(result);
            } else
            {
                while (left - n > 0)
                {
                    result++;
                    left -= n;
                }
                out.println(result);
            }

        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskCF393D2B solver = new TaskCF393D2B();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskCF393D2B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int k = in.nextInt();

            int min = 1;
            int max = m - n + 1;

            int maxPossible = 0;

            while (min <= max) {
                int mid = (min + max) / 2;

                if (possible(mid, n, m, k)) {
                    maxPossible = Math.max(maxPossible, mid);
                    min = mid + 1;
                } else {
                    max = mid - 1;
                }
            }
            out.println(maxPossible);
        }

        private boolean possible(long mid, long n, long m, long k) {
            return (m >= mid + sum(mid, k) + sum(mid, n - k + 1)) && ((mid * n) >= m);
        }

        private long sum(long a, long k) {
            long s = (a - 1) * a / 2;

            if (k >= a && (k - a) % 2 == 0) {
                s += 3 * (k - a) / 2;
            } else if (k >= a) {
                s += (k - a - 1) / 2 * 3 + 2;
            } else if (k < a) {
                s -= (a - k) * (a - k + 1) / 2;
            }
            return s;
        }

    }
}

import java.io.*;
import java.util.*;
import java.lang.*;

public final class Main {

    private int getNumberOfDays(int m) {
        return (int) (28 + (m + Math.floor(m / 8)) % 2 + 2 % m + 2 * Math.floor(1 / m));
    }

    private void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int z = 0;
        if (n - k > k) {
            z = k;
        } else {
            z = n - k + 1;
        }
        int sum = ((2 + (n - z - 1)) * (n - z)) / 2;
        int fr = 1 + (n - z);
        if (z != 1 && z != n) {
            sum += (fr - 1 - (z - 2)) * (z - 1) / 2;
        }
        while (fr + sum > m) {
            fr--;
            sum -= n - 1;
        }
        while (fr + sum + n <= m) {
            fr += 1;
            sum += n - 1;
        }
        out.println(fr);

    }

    //    -------------I/O-------------    \\
    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    public static void main(String[] args) {
        new Main().runIO();
    }

    private FScanner in;
    private PrintWriter out;

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}

import java.util.Scanner;

public class Main{
    public static void main(String...args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long m = sc.nextLong();
        long k = sc.nextLong()-1;
        long side = n - k + 1;
        long left = 1;
        long right = m + 1;
        long middle, sideOne, sideTwo;

        while (left < right - 1){
            middle = (left + right) / 2;
            if (k > middle - 1) sideOne = ((middle - 1) * middle) / 2 + k - middle + 1;
            else sideOne = ((middle - 1 + middle - k) * k) / 2;
            if (side > middle - 1) sideTwo = ((middle - 1) * middle) / 2 + side - middle + 1;
            else sideTwo = ((middle - 1 + middle - side) * side) / 2;
            if (m >= sideOne + sideTwo + middle) left = middle;
            else right = middle;
        } System.out.println(left+1); }
}

import java.util.Scanner;

public class ProplemSolving {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
            long n,m,k;
            n=sc.nextLong();
            m=sc.nextLong();
            k=sc.nextLong();

            long p,s,t,ans;
            p=m-n;
            s=n;
            t=sum(n-k)+sum(k-1);
            ans=(p+t)/s;
        System.out.println(++ans);

    }
    public static long sum(double n){
        n=(n/2)*(n+1);
        long s =(long)n;
        return s;
    }

}

import java.util.Scanner;

public class C290119 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();

		int yl = k - 1;
		int yr = n - k;

		int l = -1;
		int r = m;
		int cur = 0;
		int curyl = 0;
		int curyr = 0;

		while (l < r - 1) {
			cur = (l + r) / 2;
			if (yl > cur - 1) {
				curyl = ((cur - 1) * cur) / 2 + yl - cur + 1;
			} else {
				curyl = ((cur - 1 + cur - yl) * yl) / 2;
			}

			if (yr > cur - 1) {
				curyr = ((cur - 1) * cur) / 2 + yr - cur + 1;
			} else {
				curyr = ((cur - 1 + cur - yr) * yr) / 2;
			}

			if (m >= curyl + curyr + cur) {
				l = cur;
			} else {
				r = cur;
			}

		}

		System.out.println(l);
//		System.out.println(l);
//		System.out.println(r);

	}

}

import java.io.*;
import java.util.*;
import java.lang.*;

public final class Main {

    private int getNumberOfDays(int m) {
        return (int) (28 + (m + Math.floor(m / 8)) % 2 + 2 % m + 2 * Math.floor(1 / m));
    }

    private void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();

        boolean right = false, left = false;
        if (k >= n / 2){
            right = true;
        }else{
            left = true;
        }

        int res = 0;
        m -= n;
        res++;
        if (m > 0){
            res++;
        }
        boolean side = false;
        int add;
        if (k != 1 && k != n){
            add = 3;
        }else{
            side = true;
            add = 2;
        }

        int count = k;
        while (m > 0){
            m -= add;
            if (m >= 0){
                res++;
            }else{
                out.print(res);
                return;
            }

            if (left){
                if (count == 1){
                    side = true;
                }
            }else if (right){
                if (count == n){
                    side = true;
                }
            }

            if (side){
                add += 2;
            }else{
                add += 1;
            }

            if (right){
                count++;
            }else if (left){
                count--;
            }
        }

        out.print(res);
    }

    //    -------------I/O-------------    \\
    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    public static void main(String[] args) {
        new Main().runIO();
    }

    private FScanner in;
    private PrintWriter out;

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main30 {

	public static void main(String[] args) throws IOException
	{
		BufferedReader in;
		File file = new File("in");
		StringBuilder out = new StringBuilder("");
		if (file.exists()) {
			in = new BufferedReader(new FileReader(file));
		} else {
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		String lines[];
		int n, m, k;
		lines = in.readLine().split("\\s+");
		n = Integer.parseInt(lines[0]);
		m = Integer.parseInt(lines[1]);
		k = Integer.parseInt(lines[2]);
		int s = m-n;

		int result = 1;
		if ( s != 0)
		{
		int left = k -1 ;
		int right = n - k;
		int min = Math.min(left, right);
		int max = Math.max(left, right);
		int c = (int)Math.sqrt(s);
		int c1 = Math.min(min+1, c);

		result += c1;
		s -= c1*c1;
		//System.out.println(c1);

		int v = 2*c1-1;
		int r = n - v;
		for( int i = v+1, j = 1; j <= r; i++, j++  )
		{
			if ( s - i >= 0 )
			{
				s -= i;
				result++;
			}
		}

		result += s/n;
		}
		System.out.println(result);

	}

	public static int[] readInts(String line)
	{
		String lines[] = line.split("\\s+");
		int result[] = new int[lines.length];
		for( int i = 0; i < lines.length ; i++ )
		{
			result[i] = Integer.parseInt(lines[i]);
		}
		return result;
	}
}

import java.util.*;

public class Frodo_and_pillows {

	public static boolean works(double n, long m, double k, double x) {

		if (x >= k) {
			m -= k / 2 * (x - k + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
		}
		if (x >= n - k + 1) {
			m -= (n - k + 1) / 2 * (x - (n - k + 1) + 1 + x);
		} else {
			m -= x * (x + 1) / 2;
		}
		m += x;

		// System.out.println(x + " " + m);

		return m >= 0 ? true : false;

	}

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		double n = input.nextInt();
		long m = input.nextInt();
		double k = input.nextInt();

		input.close();

		int lo = 0;
		int hi = 1000000100;

		while (lo < hi - 1) {
			int mid = (lo + hi) / 2;
			if (works(n, m, k, mid)) {
				lo = mid;
			} else {
				hi = mid;
			}
		}

		System.out.println(lo);

	}

}

import java.util.*;
import java.io.*;
import java.math.*;
import static java.lang.Math.*;

public class B implements Runnable {

  public static void main(String[] args) {
    new Thread(null, new B(), "", 1 << 28).start();
  }

  int n, m, k;

  public void run() {
    Scanner sc = new Scanner();
    n = sc.nextInt();
    m = sc.nextInt();
    k = sc.nextInt();

    long l = 0;
    long r = (int)1e9;

    for (int i = 0; i < 100; i++) {
      long mid = (l + r) / 2;
      if (attempt(mid)) {
        l = mid + 1;
      } else {
        r = mid;
      }
    }
    System.out.println(l - 1);
  }

  boolean attempt(long val) {
    long leftVal = max(0, val - (k - 1));
    long rightVal = max(0, val - (n - k));
    return 2 * sum(val) - sum(leftVal - 1) - sum(rightVal - 1) - val <= m;
  }

  long sum(long v) {
    return (v * (v + 1)) / 2;
  }

  class Pair {
    final int x, y;

    Pair(int x, int y) {
      this.x = x;
      this.y = y;
    }

    @Override
    public int hashCode() {
      return 191 * (31 + x) + y;
    }

    @Override
    public boolean equals(Object o) {
      Pair other = (Pair)o;
      return x == other.x && y == other.y;
    }
  }

  class Scanner {
    BufferedReader r;
    StringTokenizer t;

    Scanner() {
      r = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
      t = null;
    }

    String next() {
      while (t == null || !t.hasMoreTokens()) {
        try {
          t = new StringTokenizer(r.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return t.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    BigInteger nextBigInteger() {
      return new BigInteger(next());
    }
  }
}

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		long m = sc.nextLong();
		long k = sc.nextLong();
		k = Math.max(k, n-k+1);

		long sum = (2*m-k+1)*k/2;
		sum = sum + (n-k)*(2*m-n+k-1)/2;

		long ans = m;
		while(sum > m){

			sum = sum-n;
			ans--;

		}

//		long t = (sum-m)/n + ((sum-m)%n==0?0:1);
//		ans = ans - t;

		System.out.println(ans);
	}

}

import java.io.*;
import java.util.*;

public final class TaskB
{
    public static void main(String[] args)
    {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
		Solver solver = new Solver(in, out);

		solver.solve();
        in.close();
        out.flush();
        out.close();
    }

    static class Solver
    {
        int n, m, k;
        InputReader in;
        PrintWriter out;

		void solve()
		{
//			long st = System.currentTimeMillis();
			n = in.nextInt();
			m = in.nextInt();
			k = in.nextInt();

			if (n == 1)
			{
				out.println(m);

				return;
			}

/*			if (n == 2)
			{
				// tot - 2, 2 - 1, 3 - 2, ....
				int ans = 1;

				m -= 2;

				if (m > 0)
				{
					m--;
					ans++;
				}

				while (m > 1)
				{
					m -= 2;
					ans++;
				}

				out.println(ans);
			}*/

			int cnt = 1;
			int tot = m;

			tot -= n;

			if (tot > 0)
			{
				tot--;
				cnt++;
			}

			int ctr = 1;

			while (true)
			{
				int left = Math.min(k - 1, ctr);
				int right = Math.min(n - k, ctr);

				if (left + right + 1 > tot)
					break;

				if (k - 1 == ctr || n - k == ctr)
					break;

				tot -= left + right + 1;
				cnt++;
				ctr++;

			}

//			System.out.println("tot : " + tot + ", left :" + Math.min(k - 1, ctr) + ", right  : " + Math.min(n - k,
//					ctr) + ", cnt : " + cnt);
			int xx = tot / (Math.min(k - 1, ctr) + Math.min(n - k, ctr) + 1);

			cnt += xx;

			out.println(cnt);

//			System.out.println("time : " + (System.currentTimeMillis() - st));
		}

        public Solver(InputReader in, PrintWriter out)
        {
        	this.in = in;
        	this.out = out;
        }

	}

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public int[] nextIntArray(int arraySize)
        {
            int array[] = new int[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextInt();

            return array;
        }

        public long nextLong()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sign = 1;

            if (c == '-')
            {
                sign = -1;

                c = read();
            }

            long result = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                result *= 10;
                result += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return result * sign;
        }

        public long[] nextLongArray(int arraySize)
        {
            long array[] = new long[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextLong();

            return array;
        }

        public float nextFloat()
        {
            float result, div;
            byte c;

            result = 0;
            div = 1;
            c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean isNegative = (c == '-');

            if (isNegative)
                c = (byte) read();

            do
            {
                result = result * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');

            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    result += (c - '0') / (div *= 10);

            if (isNegative)
                return -result;

            return result;
        }

        public double nextDouble()
        {
            double ret = 0, div = 1;
            byte c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean neg = (c == '-');

            if (neg)
                c = (byte) read();

            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');

            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);

            if (neg)
                return -ret;

            return ret;
        }

        public String next()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do
            {
                res.appendCodePoint(c);

                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String nextLine()
        {
            int c = read();

            StringBuilder result = new StringBuilder();

            do
            {
                result.appendCodePoint(c);

                c = read();
            } while (!isNewLine(c));

            return result.toString();
        }

        public boolean isNewLine(int c)
        {
            return c == '\n';
        }

        public void close()
        {
            try
            {
                stream.close();
            } catch (IOException e)
            {
                e.printStackTrace();
            }
        }

    }

	static class CMath
	{
		static long power(long number, long power)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			if (power == 1)
				return number;

			if (power % 2 == 0)
				return power(number * number, power / 2);
			else
				return power(number * number, power / 2) * number;
		}

		static long modPower(long number, long power, long mod)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			number = mod(number, mod);

			if (power == 1)
				return number;

			long square = mod(number * number, mod);

			if (power % 2 == 0)
				return modPower(square, power / 2, mod);
			else
				return mod(modPower(square, power / 2, mod) * number, mod);
		}

		static long moduloInverse(long number, long mod)
		{
			return modPower(number, mod - 2, mod);
		}

		static long mod(long number, long mod)
		{
			return number - (number / mod) * mod;
		}

		static int gcd(int a, int b)
		{
			if (b == 0)
				return a;
			else
				return gcd(b, a % b);
		}

		static long min(long... arr)
		{
			long min = arr[0];

			for (int i = 1; i < arr.length; i++)
				min = Math.min(min, arr[i]);

			return min;
		}

		static long max(long... arr)
		{
			long max = arr[0];

			for (int i = 1; i < arr.length; i++)
				max = Math.max(max, arr[i]);

			return max;
		}

		static int min(int... arr)
		{
			int min = arr[0];

			for (int i = 1; i < arr.length; i++)
				min = Math.min(min, arr[i]);

			return min;
		}

		static int max(int... arr)
		{
			int max = arr[0];

			for (int i = 1; i < arr.length; i++)
				max = Math.max(max, arr[i]);

			return max;
		}

	}

}

/*

3 1000000000 1
3 1000000000 2

1000000000 1000000000 500000000
100000000 1000000000 50000000

1000000 1000000000 500000

*/

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class VCFB{

	void solve()
	{
		long n = ni();
		long m = ni()-n;
		long k = ni();
		long l = 1, r = m;
		long a = k, b = n-k+1;
		long mid = 0;
		while(l<=r)
		{
			mid = l + (r-l)/2;
			long f = mid*(mid+1)/2;
			long g = mid>a ? (mid-a)*(mid-a+1)/2 : 0;
			long h = mid>b ? (mid-b)*(mid-b+1)/2 : 0;
			long val = 2*f-g-h-mid;
			if(val==m)
				break;
			if(val>m)
				r = mid-1;
			else
			{
				if(l==mid)
					l = mid+1;
				else
					l = mid;
			}
		}
		out.println(l<=r ? ++mid:mid);
	}

	public static void main(String[] args){new VCFB().start();}

	private byte[] bufferArray = new byte[1024];
	private int bufLength = 0;
	private int bufCurrent = 0;
	InputStream inputStream;
	PrintWriter out;

	void start()
	{
		inputStream = System.in;
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	int nextByte()
	{
		if(bufLength==-1)
			throw new InputMismatchException();
		if(bufCurrent>=bufLength)
		{
			bufCurrent = 0;
			try
			{bufLength = inputStream.read(bufferArray);}
			catch(IOException e)
			{ throw new InputMismatchException();}
			if(bufLength<=0)
				return -1;
		}
		return bufferArray[bufCurrent++];
	}

	boolean isSpaceChar(int x)
	{return (x<33 || x>126);}

	boolean isDigit(int x)
	{return (x>='0' && x<='9');}

	int nextNonSpace()
	{
		int x;
		while((x=nextByte())!=-1 && isSpaceChar(x));
		return x;
	}

	int ni()
	{
		int ans = 0;
		int sign = 1;
		int x = nextNonSpace();
		if(x=='-')
		{
			sign = -1;
			x = nextByte();
		}
		while(!isSpaceChar(x))
		{
			if(isDigit(x))
			{
				ans = ans*10 + x -'0';
				x = nextByte();
			}
			else
				throw new InputMismatchException();
		}
		return sign*ans;
	}

	long nl()
	{
		long ans = 0;
		long sign = 1;
		int x = nextNonSpace();
		if(x=='-')
		{
			sign = -1;
			x = nextByte();
		}
		while(!isSpaceChar(x))
		{
			if(isDigit(x))
			{
				ans = ans*10 + x -'0';
				x = nextByte();
			}
			else
				throw new InputMismatchException();
		}
		return sign*ans;
	}

	String ns()
	{
		StringBuilder sb = new StringBuilder();
		int x = nextNonSpace();
		while(!isSpaceChar(x))
		{
			sb.append((char)x);
			x = nextByte();
		}
		return sb.toString();
	}

	String nL()
	{
		StringBuilder sb = new StringBuilder();
		int x = nextNonSpace();
		while(x==32 || !isSpaceChar(x))
		{
			sb.append((char)x);
			x = nextByte();
		}
		return sb.toString();
	}

	char nc()
	{ return (char)nextNonSpace();}

	double nd()
	{ return (double)Double.parseDouble(ns()); }

	char[] ca()
	{ return ns().toCharArray();}

	char[] ca(int n)
	{
		char[] ans = new char[n];
		int p =0;
		int x = nextNonSpace();
		while(p<n)
		{
			ans[p++] = (char)x;
			x = nextByte();
		}
		return ans;
	}

	int[] ia(int n)
	{
		int[] ans = new int[n];
		for(int i=0;i<n;i++)
			ans[i]=ni();
		return ans;
	}

	long[] la(int n)
	{
		long[] ans = new long[n];
		for(int i=0;i<n;i++)
			ans[i] = nl();
		return ans;
	}

}

import java.util.Scanner;

public class frodoAndPillow {

	public static int solveFor(int n ,int m,int k) {
		int start=1,end=m;
		int ans=1;
		while(start<=end) {
		int middle=(start+end)/2;

		if(totalPillows(n,k,middle)>m) end=middle-1;
		else {
			start=middle+1;
			ans=middle;
		}

		}
		return ans;
	}

	public static int totalPillows(int n,int k,int possibleAnswer) {
		int rightBeds=n-k;
		int leftBeds=n-rightBeds-1;
		int rightSum=(rightBeds*possibleAnswer)-(((rightBeds+1)*rightBeds)/2);
		int leftSum=(leftBeds*possibleAnswer)-(((leftBeds+1)*leftBeds)/2);
		return  possibleAnswer+rightSum+leftSum;
	}

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int m=scan.nextInt();
		int k=scan.nextInt();
		System.out.print(solveFor(n,m,k));

	}

}

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    private static Scanner scan = new Scanner(System.in);
    private static PrintStream out = new PrintStream(System.out);
    static int n, m, k;

    public static void main (String[] args) throws IOException {
        n = scan.nextInt();
        m = scan.nextInt();
        k = scan.nextInt();
        m -= n;
        if (n == 1) {out.println(m + n); return;}

        int c = 1;
        int count = 1;
        int left = k, right = k;

        while (true) {
        	//out.println(left + " " + right + " " + count + " " + m);
        	if (m < c) break;
        	m -= c;
        	if (right < n && left > 1) {left--; right++;}
        	count++;
        	c+=2;
        	c = min(c, n);
        }
        out.println(count);
    }
}

import java.io.*;
import java.util.StringTokenizer;

public final class Main {
    private FScanner in;
    //    -------------I/O-------------    \\
    private PrintWriter out;

    public static void main(String[] args) {
        new Main().runIO();
    }

    boolean isPrime(int a) {
        if (a == 1) {
            return false;
        }
        for (int i = 2; i * i <= a; i++) {
            if (a % i == 0)
                return false;
        }
        return true;
    }

    // 1 2 3 4
    //
    public void solve() {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        if (m == n) {
            out.println(1);
            return;
        }
        if (m == n + 1) {
            out.println(2);
            return;
        }
        if (m == n + 3) {
            out.println(3);
            return;
        }
        if (m == n + 5) {
            out.println(4);
            return;
        }
        if (m == n + 10) {
            out.println(5);
            return;
        }
        int z = 0;
        if (n - k > k) {
            z = k;
        } else {
            z = n - k + 1;
        }
        int sum = ((2 + (n - z - 1)) * (n - z)) / 2;
        int fr = 1 + (n - z);
        int tmp1 = fr - (z - 1);
        if (z != 1 && z != n) {

            sum += (((2 * tmp1 + (z - 2)) * (z - 1)) / 2);
        }
        int tmp = 1;
        while (fr + sum > m) {
            fr--;
            sum -= (n - 1) - tmp;
            tmp++;
        }
        while (fr + sum + n <= m) {
            fr += 1;
            sum += n - 1;
        }
        out.println(fr);
    }

    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}