import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author da_201612051
 */
public class Main {

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

  static class TaskA1 {

    public void solve(int testNumber, FastIO in, PrintWriter out) throws IOException {
      int n = in.nextInt();
      int k = in.nextInt();
      int[] query = in.nextIntArray(n);
      int cost = 0;
      Set<Integer> avaialbleBooks = new HashSet<>(k);
      int[] access = new int[81];
      Arrays.stream(query).forEach(book -> access[book]++);
      for (int i = 0; i < n; i++) {
        if (!avaialbleBooks.contains(query[i])) {
          cost++;
        }
        if (avaialbleBooks.size() < k && --access[query[i]] > 0) {
          avaialbleBooks.add(query[i]);
        } else if (access[query[i]] == 0) {
          avaialbleBooks.remove(query[i]);
        }
      }
      System.out.println(cost);
    }

  }

  static class FastIO {

    final private int BUFFER_SIZE = 1 << 16;
    private InputStream din;
    private byte[] buffer;
    private int bufferPointer;
    private int bytesRead;

    public FastIO() {
      buffer = new byte[BUFFER_SIZE];
      bufferPointer = bytesRead = 0;
    }

    public FastIO(InputStream inputStream) {
      this();
      din = new DataInputStream(inputStream);
    }

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

    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 int[] nextIntArray(int n) throws IOException {
      int[] arr = new int[n];
      for (int i = 0; i < n; i++) {
        arr[i] = nextInt();
      }
      return arr;
    }

    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++];
    }

  }
}


import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Scanner;

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

  public static void main(String[] args) {
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] A = new int[N];
    ArrayList<ArrayList<Integer>> next = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      A[i] = Integer.parseInt(sc.next());
      next.add(new ArrayList<>());
      next.get(i).add(1 << 29);
    }
    for (int i = N - 1; i >= 0; i--) {
      next.get(A[i]).add(i);
    }
    PriorityQueue<Integer> q = new PriorityQueue<>((Integer i1, Integer i2) -> {
      ArrayList<Integer> l1 = next.get(i1);
      ArrayList<Integer> l2 = next.get(i2);
      return -Integer.compare(l1.get(l1.size() - 1), l2.get(l2.size() - 1));
    });

    int ans = 0;
    for (int i = 0; i < N; i++) {
      if (q.contains(A[i])) {
        q.remove(A[i]);
        next.get(A[i]).remove(next.get(A[i]).size() - 1);
        q.add(A[i]);
      } else {
        ++ans;
        next.get(A[i]).remove(next.get(A[i]).size() - 1);
        if (q.size() == K) {
          q.poll();
        }
        q.add(A[i]);
      }
    }
    System.out.println(ans);
  }

  static int solve() {
    return 0;
  }

}


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

public class Main {
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		 //int t = fs.nextInt();

		for (int tt = 1; tt <= 1; tt++) {
			//int n=fs.nextInt();
			String s=fs.next();
			int n=s.length();
			HashMap<Character, Integer> map=new HashMap<>();
			for(int i=0;i<n;i++){
				map.put(s.charAt(i),map.getOrDefault(s.charAt(i), 0)+1);
			}

			//out.println(map);
			if(map.containsKey('7')&&map.get('7')>map.get('4')){
				out.println(7);
			}
			else if(map.containsKey('4')){
				out.println(4);
			}
			else{
				out.println(-1);
			}
		}

		out.close();
	}
	public static boolean fermit_check(int n){
        if(n<4){
            return n==2||n==3?true:false;
        }
        for (int i = 0; i < 5; i++) {
            long random =   (long) (Math.random() * (n));

            long a = 2L + random % ((long)n - 3L);
            if ((long)Math.pow(a, n - 1)% n != 1)
                return false;

        }
        return true;
    }

	public static boolean solve(int n, int arr[][]){
		return true;
	}
	public static void prime_seive(int n, int[] b) {

        Arrays.fill(b,1);
		for(int i=2;i<n;i++){
			if(b[i]==1){
				for(long j=i*(long)i;j<n;j=j+i)
					b[(int)j] = 0;
				//p.add((long)i);

			}
		}
		b[0]=b[1]=0;

    }
	public static int binarySearch(int arr[], int num) {
		if (num < arr[0]) {
			return 0;
		}
		int low = 0;
		int high = arr.length - 1;
		int index = -1;
		while (low <= high) {
			int mid = low + (high - low) / 2;

			if (arr[mid] <= num) {
				if (arr[mid] == num) {
					// System.out.println(arr[mid]+" "+mid+" "+index);
					index = Math.max(index, mid + 1);
				}
				low = mid + 1;
			}

			else {
				high = mid - 1;
			}
		}
		if (index == -1) {
			index = low;
		}
		return index;
	}

	public static int noOfonesBinary(int a) {
		int count = 0;

		int orig = a;

		while (a > 0) {
			a = a >> 1 << 1;
			if (orig - a == 1)
				count++;
			orig = a >> 1;
			a = orig;
		}
		return count;

	}

	public void swap(int[] arr, int i, int j) {
		int temp = arr[i];
		arr[i] = arr[j];
		arr[j] = temp;
	}

	public static long nCr(int n, int r) {
		long result = 1L;
		for (int i = 0; i < r; i++) {
			result *= (long) (n - i); // n * n-1 * n-2 * .... * n-(r-1)
			result /= (long) (i + 1); // r * r-1 * ... * 1
		}
		return result;
	}

	int pow(int x, int y) {
		// Initialize diff
		int res = 1;

		while (y > 0) {
			// If y is odd,
			// multiply
			// x with diff
			if ((y & 1) == 1)
				res = res * x;

			// n must be even now
			y = y >> 1; // y = y/2
			x = x * x; // Change x to x^2
		}
		return res;
	}

	public static int gcd(int a, int b) {
		if (a == 0)
			return b;

		return gcd(b % a, a);
	}

	static int gcdCoeff(int a, int b, int arr[])// euclidean gcd + extended euclidean
	{
		if (b == 0)
			return a;
		int tmp[] = { 1, 1 };// must be 1,1, because at base step b=0, a=anything, 1.0+ 1.a=a
		int diff = gcdCoeff(b, a % b, tmp);
		arr[0] = tmp[1];// x=y1
		arr[1] = (tmp[0] - (a / b) * tmp[1]);// y=(x1-(a/b)*y1)
		return diff;
	}

	static class Pair {
		int a;
		int b;

		public Pair(int x, int y ) {
			this.a = x;
			this.b = y;

		}

	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

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

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

		int[] readIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		Long[] readLongArray(int n) {
			Long[] a = new Long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

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


import java.util.Scanner;
public class DigitalSequence{

    public static void print(String s){
        System.out.println(s);
    }
    public static void main(String[] args) {
        long k = new Scanner(System.in).nextLong();
        long i = 1,t=0, c = 9,digits = 0,l=0,k2=k;
        while(t<k){
            l = t;
            t += i*c;
            i++;
            c*=10;
            digits++;
        }
        k = k-l;
        long lastNumber = (long)Math.pow(10,digits-1)-1;
        long p = k/digits,q=k%digits;
        long finalNumber =lastNumber+p;
        if(q!=0){
            finalNumber++;
        }
        while(k-digits>0)
            k = k-digits;
        String ans = ""+finalNumber;
        int index = (int)(k-1);
        print(""+ans.charAt((int)index));
    }
}


import java.util.*;

public class Solver {
    public static int count(int a[]){
        int c=0;
        for(int i=0;i<14;i++){
            if(a[i]%2==0){
                c+=a[i];
            }
        }
        return c;
    }

    public static int[] distribute(int a[],int x){
        int p=a[x];
        int q=a[x]/14;
        int t=a[x]%14;
        int aa[]=new int[14];
        for(int i=0;i<14;i++){
            aa[i]=a[i];
        }
        if(x+t> 14) {
            for (int i = x + 1; i < 14; i++) {
                aa[i] += 1;
            }
            int c = t - (14 - x);
            for (int i = 0; i <=c; i++) {
                aa[i] += 1;
            }
        }else{
            for (int i = x + 1; i <=x+t; i++) {
                aa[i] += 1;
            }
        }
        for(int i=0;i<14;i++){
            aa[i]+=q;
        }
        return aa;
    }

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n=14;
        int a[]=new int[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        int c[]=new int[n];
        for(int i=0;i<n;i++){

            c[i]=count(distribute(a,i));

        }
        //System.out.println(3%14);
        int max=Integer.MIN_VALUE;
        for(int i=0;i<n;i++){
          //  System.out.print(c[i]+" ");
            if(c[i]>=max){
                max=c[i];
            }
        }
        System.out.print(max);

    }

}


//package Round_140;

import java.util.*;

public class c {

	void run(){
		Scanner in = new Scanner(System.in);
		int n= in.nextInt();
		int m = in.nextInt();
		long sum = 0;
		long f[] = new long[n+1];
		f[1] = 2;
		if (n == 1){
			System.out.println(2 % m);
			return;
		}
		f[2] = 3*f[1] + 2;
		if (n >= 2) sum += f[2];
		//sum = 2;
		for (int i = 3; i<=n; i++){
			f[i] = (2*sum + 2) % m;
			//f[i] %= m;
			sum += f[i];
			sum %= m;
		}

		//sum = (f[n-1] + sum);

		System.out.println(sum);
	}

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

}


import java.util.Scanner;

public class BrokenChecker {
	public static void main(String[] args) {
		new Star().solve();
	}
	public void solve(){
		Scanner in = new Scanner(System.in);
	    int input = in.nextInt();
	    switch(input){
	    case 1:
	    	System.out.println("2");
	    	break;
	    case 2:
	    	System.out.println("3");
	    	break;
	    case 3:
	    	System.out.println("1");
	    	break;
	    case 4:
	    	System.out.println("2");
	    	break;
	    case 5:
	    	System.out.println("1");
	    	break;
	    }

	}

}


import java.util.Collections;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class C922 {
    public static void main(String args[]){
        Scanner in=new Scanner(System.in);
        long n=in.nextLong();
        long k=in.nextLong();
        int a[]=new int[999999999];
        for(long i=1;i<=k;i++){
            int c=(int)(n%i);
            a[c]=a[c]+1;

        }
        Set<Integer>set=new HashSet<>();
        for(int i=0;i<a.length;i++){
            set.add(a[i]);
        }
        if (Collections.max(set)==1){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}


import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(final String[] args) throws IOException {
        try(Scanner scan = new Scanner(System.in);
            PrintWriter print = new PrintWriter(System.out)) {
            final int n = scan.nextInt();
            final int l = scan.nextInt();
            final int r = scan.nextInt();
            final Floodlight[] floodlights = new Floodlight[n];
            for(int i = 0; i < n; ++i) {
                final int x = scan.nextInt();
                final int y = scan.nextInt();
                final double angle = scan.nextInt() / 180. * Math.PI;
            }
            print.println(calcMaxBeginSeg(l, r, floodlights));
        }
    }

    public static double calcMaxBeginSeg(final int left, final int right, final Floodlight[] floodlights) {
        if(right <= left) return 0.;
        final int n = floodlights.length;
        double maxLitRight[] = new double[1 << n];
        maxLitRight[0] = left;
        for(int mask = 1; mask < 1 << n; ++mask) {
            double result = left;
            for(int i = 0; i < n; ++i) {
                if(((mask >> i) & 1) == 1) {
                    result = Math.max(result, extendLitSeg(maxLitRight[mask ^ (1 << i)], floodlights[i], right));
                }
            }
            maxLitRight[mask] = result;
        }
        return maxLitRight[(1 << n) - 1] - left;
    }

    private static double extendLitSeg(final double left, final Floodlight light, final double maxRight) {
        if(left >= maxRight) return left;
        if(light.y <= 0.) throw new RuntimeException("light.y must be > 0");
        final double startAngle = Math.atan((left - light.getX()) / light.getY());
        final double endAngle = startAngle + light.angle;
        if(endAngle >= Math.PI / 2.) return maxRight;
        return Math.min(maxRight, light.getX() + light.getY() * Math.tan(endAngle));
    }

    public static class Floodlight {
        private final int x;
        private final int y;
        private final double angle;

        public Floodlight(final int x, final int y, final double angle) {
            this.x = x;
            this.y = y;
            this.angle = angle;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        public double getAngle() {
            return angle;
        }
    }

    public static class NumberUtils {
        public static interface Factorizer {
            List<Integer> factorize(int number);
        }

        /**
         * thread safe Factorizer
         */
        public static Factorizer createSmallNumberFactorizer(final int upperBound) {
            return new SmallNumberFactorizer(upperBound);
        }

        /**
         * thread safe
         */
        private static class SmallNumberFactorizer implements Factorizer {
            private int[] divisors;
            private final int upperBound;
            private boolean prepared = false;

            /**
             * lazy
             * time complexity O(n * log(n) * log(log(n))
             * memory complexity O(n)
             */
            public SmallNumberFactorizer(final int upperBound) {
                this.upperBound = upperBound;
            }

            private synchronized void prepare() {
                divisors = new int[upperBound];
                Arrays.fill(divisors, 0);
                for(int i = 2; i * i < upperBound; ++i) {
                    if(divisors[i] == 0) {
                        for(int j = i * i; j < upperBound; j += i) {
                            if(divisors[j] == 0) {
                                divisors[j] = i;
                            }
                        }
                    }
                }
                prepared = true;
            }

            /**
             * complexity O(result)
             */
            public List<Integer> factorize(int number) {
                synchronized (this) {
                    if(!prepared) {
                        prepare();
                    }
                }
                final List<Integer> result = CollectionFactory.createArrayList();
                if(number < 2) return result;
                if(number >= upperBound) throw new RuntimeException("number should be less than upper bound");
                while(divisors[number] > 0) {
                    result.add(divisors[number]);
                    number /= divisors[number];
                }
                result.add(number);
                return result;
            }
        }
    }

    public static class CollectionFactory {
        public static<T> List<T> createArrayList() {
            return new ArrayList<>();
        }

        public static<T> List<T> createArrayList(final int capacity) {
            return new ArrayList<>(capacity);
        }
    }

    public static class CollectionUtils {
        public static<T> List<T> unique(final List<T> list) {
            final List<T> result = CollectionFactory.createArrayList();
            T p = null;
            for(T elem : list) {
                if(!elem.equals(p)) {
                    result.add(elem);
                    p = elem;
                }
            }
            return result;
        }

        public static<T extends Comparable<T>> T max(final List<T> list, final T lowerBound) {
            T result = lowerBound;
            for(T elem : list) {
                if(elem.compareTo(result) > 0) {
                    result = elem;
                }
            }
            return result;
        }
    }

}


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

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }

    void solve() throws IOException {
        long W=nl(); int H=ni();
        int U1=ni(); int D1=ni();
        int U2=ni(); int D2=ni();
        for (int x=H;x>=Math.max(D1,D2);x--) W+=x;
        W=Math.max(0,W-(D1>D2?U1:U2));
        for (int x=Math.max(D1,D2)-1;x>=Math.min(D1,D2);x--) W+=x;
        W=Math.max(0,W-(D1>D2?U2:U1));
        for (int x=Math.min(D1,D2)-1;x>0;x++) W+=x;
        System.out.println(W);
    }

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


import java.util.*;
public class Main {
    public static void main(String args[] ) throws Exception {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
		String str = scan.next();
		int count = 0;
		for(int i=0;i<n-1;i++){
			//System.out.println(i+"."+str.substring(i,i+2));
			if(str.substring(i,i+2)=="RU") || str.substring(i,i+2)=="UR"){
				//System.out.print(str.substring(i,i+2));
				count++;
				i++;
			}

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


package Ed_Rd_33;
import java.util.*;

public class A_Chess_For_3 {

	public static void main(String[] args){

		Scanner in = new Scanner(System.in);
		int num = in.nextInt();
		int ctst1 = 1;
		int ctst2 = 2;
		int spct = 3;
		int winner;
		int space;

		for(int i = 0; i < num; i++){
			winner = in.nextInt();

			if(winner == spct){
				System.out.print("NO");
				return;
			}
			if(winner == ctst1){
				space  = ctst2;
				ctst2 = spct;
				spct = space;
				continue;

			} else if(winner == ctst2){
				space = ctst1;
				ctst1 = spct;
				spct = space;
				continue;
			}

		}
		System.out.print("YES");

	}

}


import java.io.*;
import java.util.*;
import java.math.BigInteger;
import static java.lang.Math.*;
import static java.math.BigInteger.*;

public class Main {

    void run(){
        boolean oj = System.getProperty("ONLINE_JUDGE")!=null;
//        boolean oj = false;
        if( oj ){
            br  = new BufferedReader( new InputStreamReader (System.in ) );
            out = new PrintWriter   ( new OutputStreamWriter(System.out) );
        }
        else{
            try{
                br  = new BufferedReader(new FileReader("abc.in"));
                out = new PrintWriter(   new FileWriter("abc.out") );
            } catch (IOException e) {
                MLE();
            }
        }
        long tBeg = System.currentTimeMillis();
        solve();
//        deb();
//        out.println( "TIME: " + (System.currentTimeMillis()-tBeg)/1e3 );
        out.flush();
    }

    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    String next() {
        while( in==null || !in.hasMoreTokens() )
            try {
                in = new StringTokenizer( br.readLine() );
            } catch (IOException e) {
                MLE();
            }
        return in.nextToken();
    }

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

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

    public static void main(String[] args) throws IOException {
        new Thread( null, new Runnable() {
            @Override
            public void run() {
                new Main().run();
            }
        }, "myThread", 1<<30 ).run();
    }

    void MLE(){
//        for(;;);
        int[][] adj = new int[1024*1024][];
        for( int i = 0; i < adj.length; ++i )
            adj[i] = new int[1024*1024];
    }

//    final int cntBits = 29;
//
//    HashMap<Integer,Integer> mem = new HashMap<Integer, Integer>();
//    int g( int msk ){
//        if( mem.containsKey(msk) )
//            return mem.get(msk);
//
//        if( msk == 0 ){
//            mem.put(msk,0);
//            return 0;
//        }
//
//        boolean[] u = new boolean[200];
//        for( int i = 1; i <= cntBits; ++i ){
//            if(!( (msk&(1<<i)) != 0 ))continue;
//            int toMsk = msk;
//            for( int j = i; j <= cntBits; j+=i ){
//                toMsk &= ~(1<<j);
//            }
//            u[g(toMsk)] = true;
//        }
//        for( int ansG = 0; ; ++ansG )
//            if( !u[ansG] ){
//                mem.put(msk,ansG);
//                return ansG;
//            }
//    }

    final int[] g = new int[]{0, 1, 2, 1, 4, 3, 2, 1, 5, 6, 2, 1, 8, 7, 5, 9, 8, 7, 3, 4, 7, 4, 2, 1, 10, 9, 3, 6, 11, 12};

    void solve(){
//        for( int c = 1; c <= cntBits; ++c ){
//            int msk = 0;
//            for( int j = 1; j <= c; ++j )
//                msk |= (1<<j);
//            out.print( ", " + g(msk) );
//        }
//        out.println();

        int n = nextInt();
        int s = g[1];
        int other = n-1;

        BitSet bs = new BitSet();
        int i;
        for( i = 2; i*i <= n; ++i ){
            if( bs.get(i) ) continue;

            int a = 0;
            for( long j = i; j <= n;  j *= i, ++a, --other ){
                if( j < 1e5 ) bs.set((int)j,true);
            }
            s ^= g[a];
        }
        if( other%2==1 ) s ^= 1;
        out.println( s != 0? "Vasya" : "Petya" );
    }

}import java.io.*;
import java.util.*;
import java.math.BigInteger;
import static java.lang.Math.*;
import static java.math.BigInteger.*;

public class Main {

    void run(){
        boolean oj = System.getProperty("ONLINE_JUDGE")!=null;
//        boolean oj = false;
        if( oj ){
            br  = new BufferedReader( new InputStreamReader (System.in ) );
            out = new PrintWriter   ( new OutputStreamWriter(System.out) );
        }
        else{
            try{
                br  = new BufferedReader(new FileReader("abc.in"));
                out = new PrintWriter(   new FileWriter("abc.out") );
            } catch (IOException e) {
                MLE();
            }
        }
        long tBeg = System.currentTimeMillis();
        solve();
//        deb();
//        out.println( "TIME: " + (System.currentTimeMillis()-tBeg)/1e3 );
        out.flush();
    }

    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    String next() {
        while( in==null || !in.hasMoreTokens() )
            try {
                in = new StringTokenizer( br.readLine() );
            } catch (IOException e) {
                MLE();
            }
        return in.nextToken();
    }

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

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

    public static void main(String[] args) throws IOException {
        new Thread( null, new Runnable() {
            @Override
            public void run() {
                new Main().run();
            }
        }, "myThread", 1<<30 ).run();
    }

    void MLE(){
//        for(;;);
        int[][] adj = new int[1024*1024][];
        for( int i = 0; i < adj.length; ++i )
            adj[i] = new int[1024*1024];
    }

//    final int cntBits = 29;
//
//    HashMap<Integer,Integer> mem = new HashMap<Integer, Integer>();
//    int g( int msk ){
//        if( mem.containsKey(msk) )
//            return mem.get(msk);
//
//        if( msk == 0 ){
//            mem.put(msk,0);
//            return 0;
//        }
//
//        boolean[] u = new boolean[200];
//        for( int i = 1; i <= cntBits; ++i ){
//            if(!( (msk&(1<<i)) != 0 ))continue;
//            int toMsk = msk;
//            for( int j = i; j <= cntBits; j+=i ){
//                toMsk &= ~(1<<j);
//            }
//            u[g(toMsk)] = true;
//        }
//        for( int ansG = 0; ; ++ansG )
//            if( !u[ansG] ){
//                mem.put(msk,ansG);
//                return ansG;
//            }
//    }

    final int[] g = new int[]{0, 1, 2, 1, 4, 3, 2, 1, 5, 6, 2, 1, 8, 7, 5, 9, 8, 7, 3, 4, 7, 4, 2, 1, 10, 9, 3, 6, 11, 12};

    void solve(){
//        for( int c = 1; c <= cntBits; ++c ){
//            int msk = 0;
//            for( int j = 1; j <= c; ++j )
//                msk |= (1<<j);
//            out.print( ", " + g(msk) );
//        }
//        out.println();

        int n = nextInt();
        int s = g[1];
        int other = n-1;

        boolean[] u = new boolean[(int)1e5];
        int i;
        for( i = 2; i*i <= n; ++i ){
            if( u[i] ) continue;
            u[i] = true;

            int a = 0;
            for( long j = i; j <= n;  j *= i, ++a, --other ){
                if( j < u.length ) u[(int)j] = true;
            }
            s ^= g[a];
        }
        if( other%2==1 ) s ^= 1;
        out.println( s != 0? "Vasya" : "Petya" );
    }

}


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

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

class TaskD {
    public void solve(int testNumber, Reader in, OutputWriter out) {
        long n = in.nextLong();
        ArrayList<Integer> lengths = new ArrayList<Integer>();
        long ones = n;
        boolean[] used = new boolean[101010];
        for(int i = 2; i * i <= n; ++i){
            if (used[i])
                continue;
            long j = i;
            int len = 0;
            while(j <= n) {
                if(j < 101010)
                    used[j] = true;
                ++len;
                j *= i;
            }

            lengths.add(len);
            ones -= len;
        }

        long gandy = 0;

        if(ones % 2 != 0)
            gandy ^= gandy(1);
        long[] dp = new long[30];
        for(int i = 0; i < 30; ++i) {
            dp[i] = gandy(i);
        }
        for (Integer length : lengths) {
            gandy ^= dp[length];
        }

        out.println(gandy == 0 ? "Petya" : "Vasya");
    }

    private long gandy(int length) {
        if (length == 0) return 0;
        if (length == 1) return 1;
        if (length == 2) return 2;
        if (length == 3) return 1;
        if (length == 4) return 4;
        if (length == 5) return 3;
        if (length == 6) return 2;
        if (length == 7) return 1;
        if (length == 8) return 5;
        if (length == 9) return 6;
        if (length == 10) return 2;
        if (length == 11) return 1;
        if (length == 12) return 8;
        if (length == 13) return 7;
        if (length == 14) return 5;
        if (length == 15) return 9;
        if (length == 16) return 8;
        if (length == 17) return 7;
        if (length == 18) return 3;
        if (length == 19) return 4;
        if (length == 20) return 7;
        if (length == 21) return 4;
        if (length == 22) return 2;
        if (length == 23) return 1;
        if (length == 24) return 10;
        if (length == 25) return 9;
        if (length == 26) return 3;
        if (length == 27) return 6;
        if (length == 28) return 11;
        if (length == 29) return 12;
        throw new AssertionError();
    }
}

class Reader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public Reader(BufferedReader reader) {
        this.reader = reader;
    }

    public Reader(InputStream stream) {
        this(new BufferedReader(new InputStreamReader(stream)));
    }

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

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

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

class OutputWriter extends PrintWriter {

	public OutputWriter(OutputStream out) {
		super(out);
	}

	public OutputWriter(java.io.Writer writer){
		super(writer);
	}

	}


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

public class Hello
{

	static long expo(int n ,int m){

		long res=1,x=2;
		while(m>0)
		{
			if(m%2==1)
			{
				if(res*x>n) return n;
				res=res*x;
			}
			x=(x*x);
			m=m/2;
		}
		return n%res;
	}
    public static void main(String[] args){

        FastScanner s= new FastScanner();
        int n=s.nextInt();
        int m=s.nextInt();
        System.out.println(expo(m,n));

     }

static class FastScanner {

    private InputStream mIs;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;

	public FastScanner() {
		this(System.in);
	}

	public FastScanner(InputStream is) {
		mIs = is;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = mIs.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.awt.List;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main
{
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	void solve()
	{
		long n=nl(), m=nl();
		if(n>26) {
			out.println(m);
			return;
		}
		long p=pow(2,n,m);
		out.println(m%p);
	}

	public static long pow(long a, long n, long mod) {
		//		a %= mod;
		long ret = 1;
		int x = 63 - Long.numberOfLeadingZeros(n);
		for (; x >= 0; x--) {
			ret = ret * ret % mod;
			if (n << 63 - x < 0)
				ret = ret * a % mod;
		}
		return ret;
	}

	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}

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

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf)
		{
			ptrbuf = 0;
			try
			{ lenbuf = is.read(inbuf); }
			catch (IOException e)
			{ throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c)
	{ return !(c >= 33 && c <= 126); }
	private int skip()
	{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd()
	{ return Double.parseDouble(ns()); }
	private char nc()
	{ return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b)))
		{ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b)))
		{
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}

		while(true)
		{
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o)
	{ System.out.println(Arrays.deepToString(o)); }
}


import java.util.Scanner;

public class as {

	public static void main(String[] args) {
		Scanner scan = new Scanner (System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int n = scan.nextInt();
		int [] f = new int [n+2];
		f[0] = 0;
		f[1] = a;
		f[2] = b;
		for (int i=3 ; i < n+2 ; i++) {
			f[i] = f[i-1] - f[i-2];
		}
		if (f[n] < 0) {
			while (f[n] < 0) {
			    f[n] += 1000000007;
			}
		}
		System.out.print(f[n] % 1000000007);
	}
}


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

public class Main
{
    public static void main(String srgs[])throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String str[]=br.readLine().split(" ");
        int a=Integer.parseInt(str[0]);
        int b=Integer.parseInt(str[1]);
        int c=Integer.parseInt(str[2]);
        long val=0,n=0;
        long dig=0;
        int index=0;
        long arr[]=new long[100000000];
        for(int i=1;i<=81;i++)
        {
            val=(long)Math.pow(i, a);
            val=val*b;
            val+=c;
            n=val;
            long sum=0;
            while(n>0)
            {
                dig=n%10;
                sum+=dig;
                n=n/10;
            }
            if(sum==i && val>0 && val<1000000000)
            {
                arr[index]=val;
                index++;
            //  System.out.println(i+" "+val+" "+index);
            }
        }

        System.out.println(index);
        Arrays.sort(arr,0,index);
        if(index!=0)
        {
        for(int i=0;i<index;i++)
        {
            if(i==index-1)
                System.out.print(arr[i]);
            else
                System.out.print(arr[i]+" ");

        }
        }

    }
}


//package codeforcesa1;
import java.util.*;
public class AlenasSchedule {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int a[]=new int[n];
        ArrayList al=new ArrayList();
        for(int i=0;i<n;i++)
        {
            a[i]=in.nextInt();
        }
        int start=0;
        int end=0;
        for(int i=0;i<n;i++)
        {
            if(a[i]==1){
                start=i;
                break;
            }
        }
        for(int i=n-1;i>=0;i--)
        {
            if(a[i]==1){
                end=i;
                break;
            }
        }
        //System.out.println("start="+start);
        //System.out.println("end="+end);
        if(n==1 && a[0]==0)
        {
            System.out.println("0");
        }
        else if(n==1 && a[0]==1)
        {
            System.out.println("1");
        }
        else if(start>end)
                {
                    System.out.println("0");
                }
        else{
            int count=0;

            for(int i=start;i<=end;i++)
            {
                if(a[i]==1){
                    count++;
                }else{
                    if(a[i-1]==1 && a[i+1]==1)
                    {
                        count++;
                    }
                    else{
                        continue;
                    }
                }
            }
            System.out.println(count);
        }

    }
}


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

public class Test {
	static BufferedReader reader;
	static StringTokenizer tokenizer;
	static PrintWriter writer;

	static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

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

	 static class R implements Comparable<R>{
	        int x, y;
	        public  R(int x, int y) {
	            this.x = x;
	            this.y = y;
	        }
	        public int compareTo(R o) {
            		return x-o.x;     //Increasing order(Which is usually required)
        		}
	    }

	public static void main(String[] args) throws IOException {
		reader = new BufferedReader(new InputStreamReader(System.in));
		tokenizer = null;
		writer = new PrintWriter(System.out);
		solve();
		reader.close();
		writer.close();
	}

	private static void solve() throws IOException {
		int n = nextInt();
		int[] a=new int[n];
		int[] s=new int[3];
		for(int i=0;i<n;i++){
			a[i]=nextInt();
			s[i%3]+=a[i];
		}
		if(s[0]>=s[1]&&s[0]>=s[2])
        writer.println("chest");
    else if(s[1]>=s[0]&&s[1]>=s[2])
        writer.println("biceps");biceps\n");
    else
        writer.println("back");

	}
}


public class D {
    static long[][] dp;

    public static long solve(int nodes, int height) {
        if (nodes == 0) {
            if (height == 0)
                return 1;
            return 0;
        }
        if (dp[nodes][height] != -1)
            return dp[nodes][height];
        long res = 0;
        for (int i = 0; i <= nodes - 1; i++) {
            if (height > 1) {
                res += solve(i, height - 1) * solve(nodes - 1 - i, 0)
                        + solve(i, 0) * solve(nodes - 1 - i, height - 1)
                        - solve(i, height - 1)
                        * solve(nodes - 1 - i, height - 1);
            } else {
                res += solve(i, 0) * solve(nodes - 1 - i, 0);
            }
        }
        return dp[nodes][height] = res;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int h = sc.nextInt();
        dp = new long[n + 1][h + 1];
        for (int i = 0; i <= n; i++)
            Arrays.fill(dp[i], -1);
        System.out.println(solve(n, h));
    }
}


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

public class Template implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    class GraphBuilder {
        int n, m;
        int[] x, y;
        int index;
        int[] size;

        GraphBuilder(int n, int m) {
            this.n = n;
            this.m = m;
            x = new int[m];
            y = new int[m];
            size = new int[n];
        }

        void add(int u, int v) {
            x[index] = u;
            y[index] = v;
            size[u]++;
            size[v]++;
            index++;
        }

        int[][] build() {
            int[][] graph = new int[n][];
            for (int i = 0; i < n; i++) {
                graph[i] = new int[size[i]];
            }
            for (int i = m - 1; i >= 0; i--) {
                int u = x[i];
                int v = y[i];
                graph[u][--size[u]] = v;
                graph[v][--size[v]] = u;
            }
            return graph;
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    <T> List<T>[] createGraphList(int size) {
        List<T>[] list = new List[size];
        for (int i = 0; i < size; i++) {
            list[i] = new ArrayList<>();
        }
        return list;
    }

    public static void main(String[] args) {
        new Template().run();
        // new Thread(null, new Template(), "", 1l * 200 * 1024 * 1024).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

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

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                time();
                memory();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    void solve() throws IOException {
        int n = readInt();
        int[] a = readIntArray(n);
        Arrays.sort(a);
        for (int x : a) out.print(x + " ");
    }

    void sleep(int timer) {
        try {
            Thread.sleep(time);
        } catch (Exception e) {

        }
    }

}


import java.util.*;

import java.util.Arrays;

public class FirstCode
{

     public static void main(String [] args) {
    	Scanner sc=new Scanner(System.in);
    	int n=sc.nextInt(),x,t;

    	int i=0,c=0,d=n,k=0;
    	while(d!=0)
    	{
    		n=n/10;
    		k++;
    	}
    	int [] a=new int[k];

    	while(n!=0)
    	{

    		x=n%10;
    		t=x;
    		x=9-x;
    		if(t>x)
    		{
    			if(x==0)
    			{
    				if(c==0)
    					a[i]=t;
    				else
    					a[i]=x;
    				}
    			else
    				a[i]=x;

    		}
    		else
    			a[i]=t;
    		i++;
    		n=n/10;
    		c++;

    	}
    	for(i=c-1;i>=0;i--)
    		System.out.print(a[i]);

     }
}


import java.util.Scanner;
import java.util.*;
public class project{
    public static void main(String[]args)
    {
	Scanner s = new Scanner(System.in);

	int n =s.nextInt(), k=s.nextInt();

          String str = s.next();
          str='Y'+str;
          str+='Y';
         char[] x = str.toCharArray();

          int cur =0 ,ans = 0;
          boolean t=false;
          for(int i=1;i<=n;i++)
          {
                    if(t && x[i]=='N')
                    {
                              cur++;
                    }
                    if(!t && x[i]=='N')
                    {
                              t=true;
                              cur++;
                    }
                    if(x[i]!='N')
                    {
                        if (ans < cur)
                        ans = cur;

                              t=false;
                              cur=0;
                    }
          }

          if (ans < cur) ans = cur;
          //cout<<ans<<endl;
          if(ans>k)
          {
                    System.out.println("NO");

          }
          else
          {
          boolean vyv = false;
          for(int i=1;i<=n;i++)
          {
                    //cout<<x<<endl;
                    //cout<<i-1<<"  "<<i+k<<endl;
                    //cout<<x[i-1]<<" "<<x[i+k]<<endl;
                    if((x[i-1]=='Y' || x[i-1]=='?') && (x[i+k]=='Y' || x[i+k]=='?'))
                    {
                              t=true;
                              for(int j=i;j<k+i;j++)
                              {
                                        if(x[j]=='Y')
                                                  t=false;
                              }
                              if(t)
                              {
                                        System.out.println("YES");
                                      vyv = true;
                                      break;
                              }
                    }
          }
          if (!vyv)
          System.out.println("NO");
          }
    }
}


import java.util.*;

public class Sol{
    public static void main(String[] argc){
        Scanner sc = new Scanner(System.in);
        int n, k;
        String s;
        n = sc.nextInt();
        k = sc.nextInt();
        s = sc.next();

        boolean found = false;
        for (int i = 0; i < n; ++i) {
            int st = i;
            int en = i + k - 1;
            if (st -1 >=0 and s․charAt(st-1) == 'N') {
                continue;
            }
            if (en +1 <n and s.charAt(en +1) == 'N') {
                continue;
            }
            if (en >= n) {
                break;
            }

            boolean ok = true;
            for (int j = st; j <= en; ++j) {
                if (s.charAt(j) == 'Y') {
                    ok = false;
                }
            }
            if (ok) {
                found = true;
                break;
            }
        }

        int maxn = 0;

        for (int i = 0; i < n; ++i) {
            if (s.charAt(i) != 'N') {
                continue;
            }
            int cnt = 1;
            int j = i + 1;
            while (j < n && s.charAt(j) == 'N') {
                ++cnt;
                ++j;
            }

            if (cnt > maxn) {
                maxn = cnt;
            }
        }

        if (found && maxn <= k) {
            System.out.println("YES");
        }
        else {
            System.out.println("NO");
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class TheChildAndHomework {

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

        Scanner cin = new Scanner(System.in);
        int a[] = new int[4];

        int min = 101, max = -1, c1 = 0, c2 = 0;
        int mi = 0, ma = 0;
        char ch1 = 0, ch2 = 0;
        for (int i = 0; i < 4; i++) {
            String x = cin.nextLine();
            int len = x.length() - 2;
            a[i] = len;
            if (len < min) {
                min = len;
                ch1 = x.charAt(0);
                mi = i;
            }
            if (len > max) {
                max = len;
                ch2 = x.charAt(0);
                ma = i;
            }

        }
        //System.out.println(ch1);
        //System.out.println(ch2);

        for (int i = 0; i < 4; i++) {
            if (i != mi && 2 * min <= a[i]) {
                c1++;
            }
        }
        //System.out.println(c1);
        for (int i = 0; i < 4; i++) {
            if (i != ma && 2 * a[i] <= max) {
                c2++;
            }

        }
        //System.out.println(c2);
        if (c1 == 3)
            System.out.println(ch1);
        else if (c2 == 3)
            System.out.println(ch2);
        else
            System.out.println('C');

    }

}


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

public class Problem
{
	PrintWriter out;
	BufferedReader in;
	StringTokenizer st;

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

	String nextToken() throws Exception
	{
		if (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	void solve() throws Exception
	{
		boolean[] nums = new boolean[6];
		for (int i = 0; i < 6; i++)
			nums[i] = (nextInt() > 0) ? true : false;

		/*for (int i =0; i < 6; i++) {
			out.print(nums[i]);
			out.print(" ");
		}
		out.println();*/

		if ((! nums[0] && ! nums[1] && ! nums[2]) == (nums[3] && nums[4] && nums[5]))
			out.print("NO");
		else
			out.print("YES");

	}
	void run() throws Exception
	{
		st = new StringTokenizer("");
		//in = new BufferedReader(new FileReader("input.txt"));
		in = new BufferedReader(new InputStreamReader(System.in));
		//out = new PrintWriter("output.txt");
		out = new PrintWriter(new OutputStreamWriter(System.out));
		solve();
		out.flush();
	}
	public static void main(String[] args) throws Exception
	{
		new Problem().run();
	}
}


import java.util.ArrayList;
import java.util.Scanner;

public class Solution {

    public static void main(String args[]){

        Scanner scn = new Scanner(System.in);
        int m = scn.nextInt();
        int s = scn.nextInt();

        // long mnum = 0;
        StringBuilder mnum = new StringBuilder();
        int sum = s;
        ArrayList<Integer> list = new ArrayList<>();

        while(sum > 0){
            for(int i = 9 ; i >= 0 ; i--){
                if(sum - i >= 0){
                    list.add(i);
                    sum-= i;
                    break;
                }
            }
        }

        if(list.size() == 0 || list.get(0) == 0){
            if(m == 0){
                System.out.println(0 + " " + 0);
                return;
            }
            else{
                System.out.println(-1 + " " + -1);
                return;
            }
        }

        while(list.size() != m){
            list.add(0);
        }

        for(int i : list){
            // mnum = mnum * 10 + i;
            // System.out.println(i);
            mnum.append(i);
        }
        // long minnum = 0;
        StringBuilder minnum = new StringBuilder();
        if(list.get(list.size() - 1) != 0){
            for(int i = list.size() - 1 ; i >= 0 ; i--){
                // minnum = minnum * 10 + list.get(i);
                minnum.append(list.get(i));
            }
        }else{
            for(int i = list.size() - 1 ; i>= 0 ; i--){
                if(list.get(i) > 0){
                    list.set(i , list.get(i) - 1);
                    break;
                }
            }

            minnum.append(1);
            for(int i = list.size() - 2 ; i >= 0 ; i--){
                // minnum = minnum*10 + list.get(i);
                minnum.append(list.get(i));
            }
        }

        System.out.println(minnum +" " +  mnum);

    }
}


/**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
    static Reader scan;
    static PrintWriter pw;
    public static void main(String[] args) {
        new Thread(null,null,"BaZ",1<<25)
        {
           public void run()
           {
               try
               {
                   solve();
               }
               catch(Exception e)
               {
                   e.printStackTrace();
                   System.exit(1);
               }
           }
        }.start();
    }
    static void solve() throws IOException
    {
        scan = new Reader();
        pw = new PrintWriter(System.out,true);
        StringBuilder sb = new StringBuilder();
        int t = 1;
        while(t-->0)
        {
           long a = nl();
           long b = nl();
           long a1[] = new long[10000000];
           long a2[] = new long[10000000];
           long b1[] = new long[10000000];
           long b2[] = new long[10000000];
           int na = 0,nb = 0;
           for(long i=1;i*i<=a;++i) {
               if(a%i==0){
                    a1[na] = i;
                    a2[na++] = a/i;
               }
           }
           for(long i=1;i*i<=b;++i) {
               if(b%i==0) {
                   b1[nb] = i;
                   b2[nb++] = b/i;
               }
           }
//           pl("na : "+na);
//           for(int i=0;i<na;++i)
//               p(a1[i]+","+a2[i]);
//           pl();
//           pl("nb : "+nb);
//           for(int i=0;i<nb;++i)
//               p(b1[i]+","+b2[i]);
//           pl();
           int idx1 = -1,idx2 = -1;
           long N = a+b;
           long ans = Long.MAX_VALUE;
           for(int i=1;i*i<=N;++i) {
               if(N%i==0) {
                   long bc = N/i;
                   while(idx1+1<na && a1[idx1+1]<=i)
                       idx1++;
                   while(idx2+1<nb && b1[idx2+1]<=i)
                       idx2++;
                   if(idx1!=-1) {
                       if(a2[idx1]<=bc) {
                           ans = min(ans, (i+bc)<<1);
                       }
                   }
                   if(idx2!=-1) {
                       if(b2[idx2]<=bc) {
                           ans = min(ans, (i+bc)<<1);
                       }
                   }
               }
           }
           pl(ans);
        }
        pw.flush();
        pw.close();
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List<Object> list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    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[64];
        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.*;
public class InternationalOlympiad
{
	public static final long INFINITY = 1000000000;

	public static HashSet<Long> used;
	public static HashMap<String, Long> map;

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

		used = new HashSet<Long>();
		map = new HashMap<String, Long>();

		PriorityQueue<Long> queue = new PriorityQueue<Long>();
		for(long x = 0; x < 1989; x++)
		{
			queue.add(x);
		}

		int max = 10;
		for(int x = 1; x <= 4; x++)
		{
			for(int y = 0; y < Math.min(max, 1989); y++)
			{
				String num = "" + y;
				while(num.length() < x)
				{
					num = '0' + num;
				}

				long next = next(num);
				map.put(num, next);
				used.add(next);
			}

			max *= 10;
		}

		int n = in.nextInt();
		for(int y = 0; y < n; y++)
		{
			String num = in.next().substring(4);

			if(map.containsKey(num))
			{
				System.out.println(map.get(num));
			}
			else
			{
				boolean result = false;
				for(int z = 0; z < num.length(); z--)
				{
					if(num.charAt(z) == '0')
					{
						result = true;
						break;
					}
					else if(used.contains(Long.parseLong(num.substring(z))))
					{
						result = true;
						break;
					}
					else if(num.charAt(z) != '1')
					{
						break;
					}
				}

				System.out.println((result ? "1" : "") + num);
			}
		}
	}

	public static long next(String num)
	{
		int shift = num.length();
		long pow = 1;
		for(int i = 0; i < shift; i++)
		{
			pow *= 10;
		}

		long val = Integer.parseInt(num);

		long left = 1 * pow;
		while(true)
		{
			if(left + val >= 1989 && !used.contains(left + val))
			{
				return left + val;
			}

			left += pow;
		}
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Niyaz Nigmatullin
 */
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);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, FastScanner in, FastPrinter out) {
            int n = in.nextInt();
            List<Long> start = new ArrayList<>();
            start.add(1989L);
            start.add(1999L);
            start.add(2099L);
            start.add(3099L);
            for (int i = 0; i < 10; i++) {
                start.add(Long.parseLong("1" + start.get(start.size() - 1)));
            }
            for (int i = 0; i < n; i++) {
                String s = in.next().substring(4);
                long a = start.get(s.length() - 1);
                long b = start.get(s.length());
                long answer = -1;
                if (s.length() <= 5) {
                    for (long e = a; e < b; e++) {
                        if ((e + "").endsWith(s)) {
                            answer = e;
                        }
                    }
                    if (answer == -1) throw new AssertionError();
                } else {
                    if (Long.parseLong(s) < a) {
                        answer = Long.parseLong("1" + s);
                    } else {
                        answer = Long.parseLong(s);
                    }
                }
                out.println(answer);
            }
//        BigInteger last = BigInteger.valueOf(1988);
//        final String[] input = new String[n];
//        for (int i = 0; i < n; i++) {
//            input[i] = in.next().substring(4);
//        }
//        Integer[] id = new Integer[n];
//        for (int i = 0; i < n; i++) {
//            id[i] = i;
//        }
//        Arrays.sort(id, new Comparator<Integer>() {
//            @Override
//            public int compare(Integer o1, Integer o2) {
//                if (input[o1].length() != input[o2].length()) {
//                    return Integer.compare(input[o1].length(), input[o2].length());
//                }
//                if (input[o1].length() == 1) {
//                    return Integer.compare((Integer.parseInt(input[o1]) + 1) % 10, (Integer.parseInt(input[o2]) + 1) % 10);
//                }
//                return input[o1].compareTo(input[o2]);
//            }
//        });
//        BigInteger[] answer = new BigInteger[n];
//        for (int i = 0; i < n; i++) {
//            String s = input[id[i]];
//            BigInteger cur = new BigInteger(s);
//            BigInteger p = BigInteger.TEN.pow(s.length());
//            BigInteger next = last.divide(p).multiply(p).add(cur);
//            while (next.compareTo(last) <= 0) {
//                next = next.add(p);
//            }
//            last = next;
//            answer[id[i]] = last;
//        }
//        for (BigInteger e : answer) {
//            out.println(e);
//        }
        }

    }

    static class FastScanner extends BufferedReader {
        public FastScanner(InputStream is) {
            super(new InputStreamReader(is));
        }

        public int read() {
            try {
                int ret = super.read();
//            if (isEOF && ret < 0) {
//                throw new InputMismatchException();
//            }
//            isEOF = ret == -1;
                return ret;
            } catch (IOException e) {
                throw new InputMismatchException();
            }
        }

        public String next() {
            StringBuilder sb = new StringBuilder();
            int c = read();
            while (isWhiteSpace(c)) {
                c = read();
            }
            if (c < 0) {
                return null;
            }
            while (c >= 0 && !isWhiteSpace(c)) {
                sb.appendCodePoint(c);
                c = read();
            }
            return sb.toString();
        }

        static boolean isWhiteSpace(int c) {
            return c >= 0 && c <= 32;
        }

        public int nextInt() {
            int c = read();
            while (isWhiteSpace(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int ret = 0;
            while (c >= 0 && !isWhiteSpace(c)) {
                if (c < '0' || c > '9') {
                    throw new NumberFormatException("digit expected " + (char) c
                            + " found");
                }
                ret = ret * 10 + c - '0';
                c = read();
            }
            return ret * sgn;
        }

        public String readLine() {
            try {
                return super.readLine();
            } catch (IOException e) {
                return null;
            }
        }

    }

    static class FastPrinter extends PrintWriter {
        public FastPrinter(OutputStream out) {
            super(out);
        }

        public FastPrinter(Writer out) {
            super(out);
        }

    }
}


/*
 * 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 codeforce;
/* package whatever; // don't place package name! */

/* package whatever; // don't place package name! */

import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args)
	{
		// your code goes here
		int a,b,t=1,c=1;
		Scanner in =new Scanner (System.in);
		a=in.nextInt();
		b=in.nextInt();
		if(b%2==0)
		{

		while(a!=b)
		{
			a=a-2;
			t=t+1;
		}
		}
		else
		{

			while(c!=b)
			{
				c=c+2;
				t=t+1;
			}
		}
		System.out.println(t);
	}
}


package Lunes;
/**
 * @author Eduardo Osorio
 * A01334501
 */
import java.util.*;
public class KeyRaces {

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

		int s = sc.nextInt();
		int v1 = sc.nextInt();
		int v2 = sc.nextInt();
		int t1 = sc.nextInt();
		int t2 = sc.nextInt();

		sc.close();

		int c1 = (t1*2)+(v1*s);
		int c2 = (t2*2)+(v2*s);

		if(c1 < c2){

			System.out.println("First");

		}else if(c1 > c2){

			System.out.println("Second");

		}else{

			System.out.println("Friendship");

		}
	}

}


package com.company;
import java.util.*;
public class Main {

    public static void main(String[] args)

    {
	    Scanner sc =new Scanner(System.in);

	    int s = sc.nextInt();
	    int v1=sc.nextInt();
        int v2=sc.nextInt();
        int t1=sc.nextInt();
        int t2=sc.nextInt();
        int sum1=0;
        int sum2=0;

        sum1=v1*s+2*t1;
        sum2=v2*s+2*t2;

        if(sum1<sum2){
            System.out.println("First");
        }
        else if(sum1==sum2){
            System.out.println("Friendship\n");
        }
        else{
            System.out.println("Second");
        }

    }
}


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
 */
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);
        Slices solver = new Slices();
        solver.solve(1, in, out);
        out.close();
    }

    static class Slices {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            boolean flag[] = new boolean[n + 1];
            for (int w = 1; w <= n - 1; w++) {

                if (n / w > 1) {
                    flag[w] = true;
                }
            }

            flag[n] = true;

            int count = 0;

            for (boolean f : flag) {
                if (f) {
                    count++;
                }
            }

            out.println(count);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.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 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) {
            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 main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		long a = input.nextLong(), b = input.nextLong();
		long counter = 1, max, min;
		if (b == 1) {
			System.out.println(a);
			return;
		}
		while (a != b) {
			max = Math.max(a, b);
			min = Math.min(a, b);
			a = max - min;
			b = min;
			counter++;
		}

		System.out.println(counter);

		input.close();
	}

}


import java.io.*;
import java.util.*;
public final class fox_and_boxes
{
	static Scanner sc=new Scanner(System.in);
	static PrintWriter out=new PrintWriter(System.out);

	public static void main(String args[]) throws Exception
	{
		int n=sc.nextInt();
		List<Integer> list=new LinkedList<Integer>();
		for(int i=0;i<n;i++)
		{
			list.add(sc.nextInt());
		}
		Collections.sort(list,Collections.reverseOrder());
		int c=0;
		while(list.size()>0)
		{
			List<Integer> dead=new LinkedList<Integer>();
			int max=list.get(0);
			dead.add(0);
			c++;
			for(int i=1;i<list.size();i++)
			{
				if(list.get(i)<max)
				{
					max=list.get(i);
					dead.add(i);
				}
			}
			for(int i=0;i<dead.size();i++)
			{
				if(dead.size()-(dead.size()-1-i)<list.get(dead.get(i)))
				{
					int space=list.get(dead.get(i))-(dead.size()-(dead.size()-1-i));
					for(int j=0;j<list.size();j++)
					{
						if(space<=0)
						{
							break;
						}
						if(!dead.contains(j) && list.get(j)==list.get(dead.get(i)))
						{
							dead.add(i+1,j);
							space--;
						}
					}
				}
			}
			int y=0;
			for(int x:dead)
			{
				list.remove(x-y);
				y++;
			}
		}
		out.println(c);
		out.close();
	}
}


//package round49;

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class E {
	Scanner in;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni();
		int m = ni();
		int k = ni();
		long[][] dp = new long[1<<n][1<<n]; // 2 1
		dp[0][0] = 1;
		for(int i = 0;i < m;i++){
			int f = ni() - 1;
			int t = ni() - 1;
			if(f > t){
				int d = f; f = t; t = d;
			}
			for(int j = (1<<n)-1;j >= 0;j--){
				for(int l = (1<<n)-1;l >= j;l--){
					if((l&j) == j){
						int nj = j;
						int nl = l;
						if((l>>f)%2 == 1){
							nj |= 1<<f;
						}else{
							nl |= 1<<f;
						}
						if((l>>t)%2 == 1){
							nj |= 1<<t;
						}else{
							nl |= 1<<t;
						}
						dp[nj][nl] += dp[j][l];
					}
				}
			}
		}

		long sum = 0;
		for(int i = 0;i < 1<<n;i++){
			if(n - Integer.bitCount(i) == k){
				sum += dp[i][(1<<n)-1];
			}
		}
		out.println(sum);
	}

	void run() throws Exception
	{
//		StringBuilder sb = new StringBuilder("10 45 5 ");
//		for(int i = 1;i <= 10;i++){
//			for(int j = i + 1;j <= 10;j++){
//				sb.append(i + " " + j + " ");
//			}
//		}
//		INPUT = sb.toString();

		in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);

		solve();
		out.flush();
	}

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

	int ni() { return Integer.parseInt(in.next()); }
	void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
}


import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: piyushd
 * Date: 1/7/11
 * Time: 12:04 AM
 * To change this template use File | Settings | File Templates.
 */
public class DeadEnds {

	long ways(int cnt, int road, boolean[] used, int[] par, int[][] roads, int N, int M, int K){
		long res = 0;

		if(cnt == N - 1){

			int[] usedJunctions = new int[N];
			for(int i = 0; i < M; i++)if(used[i]){
				usedJunctions[roads[i][0]]++;
				usedJunctions[roads[i][1]]++;
			}

			int dead = 0;
			for(int i = 0; i < N; i++) if(usedJunctions[i] == 1) dead++;

			if(dead == K) return 1;
			else return 0;

		}

		if(road == M) return res;

		if(par[roads[road][0]] != par[roads[road][1]]){

			used[road] = true;
			int x = par[roads[road][1]];
			ArrayList<Integer> oldPar = new ArrayList<Integer>();
			for(int i = 0; i < N; i++){
				if(par[i] == x){
					par[i] = par[roads[road][0]];
					oldPar.add(i);
				}
			}

			res += ways(cnt + 1, road + 1, used, par, roads, N, M, K);

			used[road] = false;
			for(Integer a : oldPar)par[a] = x;
		}

		res += ways(cnt, road + 1, used, par, roads, N, M, K);
		return res;
	}

    void run(){
		int N = nextInt(), M = nextInt(), K = nextInt();
		int[][] roads = new int[M][2];
		for(int i = 0; i < M; i++){
			roads[i][0] = nextInt() - 1;
			roads[i][1] = nextInt() - 1;
		}

		int[] par = new int[N];
		for(int i = 0; i < N; i++) par[i] = i;

		boolean[] used = new boolean[M];
		System.out.println(ways(0, 0, used, par, roads, N, M, K));
    }

    int nextInt(){
        try{
            int c = System.in.read();
            if(c == -1) return c;
            while(c != '-' && (c < '0' || '9' < c)){
                c = System.in.read();
                if(c == -1) return c;
            }
            if(c == '-') return -nextInt();
            int res = 0;
            do{
                res *= 10;
                res += c - '0';
                c = System.in.read();
            }while('0' <= c && c <= '9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }

    long nextLong(){
        try{
            int c = System.in.read();
            if(c == -1) return -1;
            while(c != '-' && (c < '0' || '9' < c)){
                c = System.in.read();
                if(c == -1) return -1;
            }
            if(c == '-') return -nextLong();
            long res = 0;
            do{
                res *= 10;
                res += c-'0';
                c = System.in.read();
            }while('0' <= c && c <= '9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }

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

    String next(){
        try{
            StringBuilder res = new StringBuilder("");
            int c = System.in.read();
            while(Character.isWhitespace(c))
                c = System.in.read();
            do{
                res.append((char)c);
            }while(!Character.isWhitespace(c=System.in.read()));
            return res.toString();
        }catch(Exception e){
            return null;
        }
    }

    String nextLine(){
        try{
            StringBuilder res = new StringBuilder("");
            int c = System.in.read();
            while(c == '\r' || c == '\n')
                c = System.in.read();
            do{
                res.append((char)c);
                c = System.in.read();
            }while(c != '\r' && c != '\n');
            return res.toString();
        }catch(Exception e){
            return null;
        }
    }

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


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

public class Try
{

    static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;

		public InputReader(InputStream st) {
			this.stream = st;
		}

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 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 {
				res *= 10;
				res += c - '0';
				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 {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nia(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = ni();
			}
			return a;
		}

		public String rs() {
			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 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 boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}

    static long mod=1000000007;
    static BigInteger bigInteger = new BigInteger("1000000007");
    static int n = (int)1e6;
    static boolean[] prime;
    static ArrayList<Integer> as;
    static void sieve() {
			Arrays.fill(prime	, true);
			prime[0] = prime[1] = false;
			for(int i = 2 ; i * i <= n ; ++i) {
				if(prime[i]) {
					for(int k = i * i; k< n ; k+=i) {
						prime[k] = false;
					}
				}
			}

		}
		static PrintWriter w = new PrintWriter(System.out);
 static char [][]sol;
    public static void main(String[] args)
    {

        InputReader sc = new InputReader(System.in);
        //PrintWriter w = new PrintWriter(System.out);

       /*
        prime  = new boolean[n + 1];
		sieve();
		prime[1] = false;
		*/
		/*
		as = new ArrayList<>();
		for(int i=2;i<=1000000;i++)
		{
		    if(prime[i])
		    as.add(i);
		}
		*/

       /*

	long a = sc.nl();

            BigInteger ans = new BigInteger("1");
            for (long i = 1; i < Math.sqrt(a); i++) {
                if (a % i == 0) {
                    if (a / i == i) {
                        ans = ans.multiply(BigInteger.valueOf(phi(i)));

                    } else {
                        ans = ans.multiply(BigInteger.valueOf(phi(i)));
                        ans = ans.multiply(BigInteger.valueOf(phi(a / i)));

                    }

                }
            }
            w.println(ans.mod(bigInteger));
            */

         // MergeSort ob = new MergeSort();
       // ob.sort(arr, 0, arr.length-1);

   String s = sc.rs();
   int c = 0;
   if(s.contains("Danil"))
       c++;
   if(s.contains("Olya"))
       c++;
   if(s.contains("Slava"))
       c++;
   if(s.contains("Ann"))
       c++;
   if(s.contains("Nikita"))
       c++;
if(c == 1)
    w.println("YES");
else
    w.println("NO");

      w.close();

    }
    static void fill(char s1,char s2,int i,int j,int so2)
    {
        for(int r=0;r<25;r++)
        {
            for(int c=0;c<25;c++)
            {
                if(r%2 == 0 || so2 == 0)
                {
                    sol[r+i][c+j] = s1;

                }
                else if(c%2==0)
                    sol[r+i][c+j] = s1;
                else
                {
                    so2--;
                    sol[r+i][c+j] = s2;
                }
            }
        }
    }
     static long modexp(long x,long n,long M)
{
    long power = n;
    long result=1;
    while(power>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        power = power/2;
    }
    return result;
}
     static long modInverse(long A,long M)
{
    return modexp(A,M-2,M);
}

     public static long modMultiply(long one, long two) {

		return (one % mod * two % mod) % mod;
	}
    static long fx(int m)
    {
        long re = 0;
        for(int i=1;i<=m;i++)
        {
            re += (long) (i / gcd(i,m));
        }
        return re;
    }
     static long gcd(long a, long b)
    {
	 if (a == 0)
	  return b;

	return gcd(b%a, a);
    }

     static long phi(long nx)
    {
        // Initialize result as n
        double result = nx;

        // Consider all prime factors of n and for
        // every prime factor p, multiply result
        // with (1 - 1/p)
        for (int p = 0; as.get(p) * as.get(p) <= nx; ++p)
        {
            // Check if p is a prime factor.
            if (nx % as.get(p) == 0)
            {
                // If yes, then update n and result
                while (nx % as.get(p) == 0)
                    nx /= as.get(p);
                result *= (1.0 - (1.0 / (double) as.get(p)));
            }
        }

        // If n has a prime factor greater than sqrt(n)
        // (There can be at-most one such prime factor)
        if (nx > 1)
            result *= (1.0 - (1.0 / (double) nx));

        return (long)result;

        //return(phi((long)result,k-1));

    }

    public static int primeFactors(int n,int x)
    {
        as = new ArrayList<>();
        int sum = 0;
        // Print the number of 2s that divide n
        while (n%2==0)
        {

            if(sum == x-1)
                break;
            as.add(2);
            //System.out.print(2 + " ");
            n /= 2;
            sum++;
        }

        // 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+= 2)
        {
            // While i divides n, print i and divide n
            while (n%i == 0)
            {

               // System.out.print(i + " ");
                if(sum == x-1)
                break;
                as.add(i);
                n /= i;
                sum++;

            }

        }

        // This condition is to handle the case whien
        // n is a prime number greater than 2
        if (n >= 2)
        {
            sum++;
            as.add(n);
        }
            return sum;
    }
    static int digitsum(int x)

    {

        int sum = 0;
        while(x > 0)
        {
            int temp = x % 10;
            sum += temp;
            x /= 10;
        }
        return sum;

    }
    static int countDivisors(int n)
    {
        int cnt = 0;
        for (int i = 1; i*i <=n; i++)
        {
             if (n % i == 0 && i<=1000000)
             {
                // If divisors are equal,
                // count only one
                if (n / i == i)
                   cnt++;

                else // Otherwise count both
                    cnt = cnt + 2;
             }
         }
        return cnt;
    }

    static boolean isprime(int n)
    {

    if(n == 2)
        return true;
    if(n == 3)
        return true;
    if(n % 2 == 0)
        return false;
    if(n % 3 == 0)
        return false;

    int i = 5;
   int w = 2;

    while(i * i <= n)
    {
        if(n % i == 0)
            return false;

        i += w;
        w = 6 - w;
    }

    return true;
    }

    static long log2(long value) {
    return Long.SIZE-Long.numberOfLeadingZeros(value);
}

    static boolean binarysearch(int []arr,int p,int n)
    {
        //ArrayList<Integer> as = new ArrayList<>();
        //as.addAll(0,at);
        //Collections.sort(as);
        boolean re = false;
        int st = 0;
        int end = n-1;

        while(st <= end)
        {
            int mid = st + (end-st)/2;

            if(p > arr[mid])
            {
                st = mid+1;

            }
            else if(p < arr[mid])
            {
                end = mid-1;

            }
            else if(p == arr[mid])
            {

            re = true;
            break;
            }

        }
         return re;

    }

    static class Student
    {

        int position;
        int value;
        Student(int position,int value)
        {
            this.position = position;
            this.value = value;

        }

    }
    /* Java program for Merge Sort */
static class MergeSort
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(int 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 */
        int L[] = new int [n1];
        int R[] = new int [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()
    void sort(int 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);
        }
    }

    /* A utility function to print array of size n */

}

    public static int ip(String s){
		return Integer.parseInt(s);
	}
	 public static String ips(int s){
		return Integer.toString(s);
	}

}


import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    int MAX = 10000000;
    int MOD = 1000000007;
    long[] fac, finv, inv;			// a! (fac[a])   (a!)の-1乗 (finv[a])
    // テーブルを作る前処理　→　これを呼んでから COM() を呼ぶ
    void COMinit() {
    	fac = new long[MAX];
    	finv = new long[MAX];
    	inv = new long[MAX];
    	fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        		fac[i] = fac[i - 1] * i % MOD;
    		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    		finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
    }
    // 二項係数計算
    long COM(int n, int k){
    	if (n < k)		return 0;
    	if (n < 0 || k < 0)		return 0;
    	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
    // a の n 乗を mod の余りで計算する
    public long modpow(long a, long n, long mod) {
    	long res = 1;
    	while(n > 0) {
    		if((n & 1) == 1)
    			res = res * a % mod;
    		a = a * a % mod;
    		n = n >> 1;
    	}
    	return res;
    }
    public void solve() {
    	int N = Integer.parseInt(sc.next());
    	int M = Integer.parseInt(sc.next());
    	COMinit();
    	long c1 = 0;
    	for (int i = 0; i <= N; i++) {
			c1 = (c1 + COM(N, i)) % MOD;
		}
//    	out.println("1  c1 = " + c1);
    	c1 = modpow(c1, M, MOD);
//    	out.println("2  c1 = " + c1);
    	long c2 = 0;
    	for (int i = 0; i < N; i++) {
			c2 = (c2 + COM(N-1, i)) % MOD;
		}
//    	out.println("3  c2 = " + c2);
    	c2 = modpow(c2, M, MOD);
//    	out.println("4  c2 = " + c2);
    	c2 = (c2 * N) % MOD;
//    	out.println("5  c2 = " + c2);
    	out.println(c1 - c2 + N - 1);
    }
}


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

public class B {
    static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
    static MyScanner sc;

    static {
        try {
            sc = new MyScanner();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        doTask();
        out.flush();
    }

    static long MOD = 1000000007L;

    public static void doTask(){
        int n = sc.nextInt(), m = sc.nextInt();

        BigInteger mod = BigInteger.valueOf(1000000007);
        BigInteger two = BigInteger.valueOf(2);
        BigInteger res = two.pow(m);
        res = res.subtract(BigInteger.ONE).mod(mod);
        long v = Long.valueOf(res.toString());
        long result = fastPow(v, n);
        out.println(result);
    }

    static long fastPow(long a, long b) {
        if (b == 1) return a;
        long rem = b - (b/2*2);
        long left = fastPow(a, b/2);
        long result = (left*left) % MOD;

        if (rem > 0) {
            long right = fastPow(a, rem);
            result = (result * right) % MOD;
        }
        return result;
    }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() throws FileNotFoundException {
            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.math.BigInteger;
import java.util.*;
import java.io.*;

public class Main {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
        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; }
    }

    public static void main(String[] args) {
        FastReader ip = new FastReader();
        OutputStream output = System.out;
        PrintWriter out = new PrintWriter(output);
        long n=ip.nextLong();
        Integer m=ip.nextInt();
        BigInteger a=new BigInteger("1");
        a=a.multiply(BigInteger.valueOf(n));

       BigInteger ans=new BigInteger("1");
        for(int i=0;i<n;i++){
          BigInteger v=BigInteger.valueOf(2).pow(m);
          v=v.subtract(BigInteger.valueOf(1));
          ans=ans.multiply(v);
          ans=ans.mod(BigInteger.valueOf(1000000007));
        }
         out.println(ans);
        out.close();
    }
}


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

public class HelloWorld
{
  public static void main(String[] args) throws Exception
  {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter writer = new PrintWriter(System.out);
    StringTokenizer st = new StringTokenizer(br.readLine());
    int n = Integer.parseInt(st.nextToken());
    int m = Integer.parseInt(st.nextToken());
    BigInteger b = new BigInteger("2");
    b = b.pow(m);
    b = b.add(BigInteger.valueOf(-1));
    b = b.pow(n);
    b = b.mod(BigInteger.valueOf(1000000007));
    writer.println(b);
    br.close();
    writer.close();
  }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.util.Arrays;
import java.math.BigInteger;
import java.util.Scanner;
public class Main{

    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;
        }
    }

    public static void main(String[] args){
        FastReader sc=new FastReader();
      int n=sc.nextInt();
      int m=sc.nextInt();

      BigInteger pow1=BigInteger.valueOf(2).pow(m).mod(BigInteger.valueOf(1000000007)).add(BigInteger.valueOf(-1));

      System.out.println(pow1.pow(n).mod(BigInteger.valueOf(1000000007)));

 }

  }