/*
* To change this template, choose Tools | Templates and open the template in
* the editor.
*/

import java.io.*;

import java.util.*;

public class Task extends ASolver {

    char[] dna;

    public static void main(String[] args) throws IOException {
        Task task = new Task();
        task.init();
        task.readData();
        task.writeData(task.solve());
    }

    @Override
    public void init() {
        super.init();
    }

    @Override
    public boolean readData() {
        try {

            dna = next().toCharArray();

        } catch (Exception ex) {
            System.out.println(ex.getCause());
            System.out.println(ex.getMessage());
            return false;
        }
        return true;
    }

    public long solve() throws IOException {

        int result = 0;

        for (int i = 0; i < dna.length; ) {

            int equalsCount = 0;
            int j = i + 1;

            while (j < dna.length && dna[j] == dna[i]) {
                equalsCount++;
                j++;
            }

            i = j;

            if (equalsCount % 2 != 0) {
                result++;
            }

        }

        return result;
    }
}

abstract class ASolver {

    protected StringTokenizer tokens;
    protected BufferedReader input;
    protected PrintWriter output;

    public void init() {
        input = new BufferedReader(new InputStreamReader(System.in));
    }

    public abstract boolean readData();

    public void writeData(String result) {
        System.out.println(result);
    }

    public void writeData(int result) {
        System.out.println(result);
    }

    public void writeData(long result) {
        System.out.println(result);
    }

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

    public byte nextByte() throws IOException {
        return Byte.parseByte(next());
    }

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

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

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

    public String nextPoints() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine(), "\n");
        }
        return tokens.nextToken();
    }

    public long infinityImitator(long a, long b) {
        if (a == Long.MIN_VALUE) {
            return Long.MIN_VALUE;
        } else {
            return a + b;
        }
    }

    public int infinityImitator(int a, int b) {
        if (a == Integer.MIN_VALUE) {
            return Integer.MIN_VALUE;
        } else {
            return a + b;
        }
    }

    /*
     * public long max(long... a) { long result = Long.MIN_VALUE; for (int i =
     * 0; i < a.length; i++) { result = Math.max(result, a[i]); } return result;
     * }
     */
    public int indexMax(int... a) {
        int result = 0;
        int index = -1;
        int length = a.length;
        for (int i = 0; i < length; i++) {
            if (a[i] > result) {
                result = a[i];
                index = i;
            }
        }
        return index;
    }

    public int indexMax(long... a) {
        long result = 0;
        int index = -1;
        int length = a.length;
        for (int i = 0; i < length; i++) {
            if (a[i] > result) {
                result = a[i];
                index = i;
            }
        }
        return index;
    }

    public int max(int... a) {
        int result = Integer.MIN_VALUE;
        for (int i = 0; i < a.length; i++) {
            result = Math.max(result, a[i]);
        }
        return result;
    }

    public long max(long... a) {
        long result = Integer.MIN_VALUE;
        for (int i = 0; i < a.length; i++) {
            result = Math.max(result, a[i]);
        }
        return result;
    }

    public int nod(int[] array) {
        int nod = array[0];

        for (int i = 1; i < array.length; i++) {
            nod = nod(nod, array[i]);
        }

        return nod;
    }

    private int nod(int m, int n) {

        int result = 0;

        if (m == 0) {
            return n;
        }

        if (n == 0) {
            return m;
        }

        if (n == m) {
            return m;
        }

        if (m == 1 || n == 1) {
            return 1;
        }

        int mDel = m % 2;
        int nDel = n % 2;

        if (mDel != 0 && nDel != 0) {
            return nod((Math.max(m, n) - Math.min(m, n)) / 2, Math.min(m, n));
        } else if (mDel == 0 && nDel != 0) {
            return nod(m / 2, n);
        } else if (mDel != 0 && nDel == 0) {
            return nod(m, n / 2);
        } else {
            return 2 * nod(m / 2, n / 2);
        }
    }
}


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

public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        char[] input = br.readLine().trim().toCharArray();

        int n = input.length;
        int ans = 0;
        int count = 1;
        for(int i= 0;i<n-1;i++){
            if(input[i] == input[i+1]){
                count++;
            }
            else{
                if(count%2 == 0)ans++;

                count= 1;
            }
        }
        if(count%2 == 0)ans++;

        System.out.println(ans);

    }

}


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

public class Main {

    public static void main(String[] args) throws java.lang.Exception {
        //Reader pm =new Reader();
        Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = pm.next();
        int n = s.length();
        int sum = 1;
        int ans = 0;
        for(int i=1;i<n;i++){
            if(s.charAt(i) == s.charAt(i-1)){
                sum++;
            }
            else {
                if(sum%2 == 0)
                    ans++;
                sum = 1;
            }
            if(i == n-1){
                if(sum%2 == 0)
                    ans++;
            }
        }
        System.out.println(ans);
    }

    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]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

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

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

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

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

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

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

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

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

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

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


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

public class cfr14A1 {
  static InputReader in = new InputReader();
  static String str = "";
  static String[] arr;

  public static void main(String[] args) throws Exception {
    // int n = Integer.parseInt(in.readLine());
    str = in.readLine();
    int count = 0;
    int run = 1;
    for(int i = 1; i < str.length(); i++) {
      if(str.charAt(i) == str.charAt(i - 1)) {
        run++;
      } else {
        if(run % 2 == 0) {
          count++;
        }
        run = 1;
      }
    }
    if(run % 2 == 0) {
      count++;
    }
    System.out.println(count);
  }

  static class InputReader {
    BufferedReader br;

    public InputReader() {
      try {
        br = new BufferedReader(new FileReader("cfr14A1.in"));
      } catch(Exception e) {
        br = new BufferedReader(new InputStreamReader(System.in));
      }
    }

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


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

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

    InputReader(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
    }

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

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

  public static void solve(InputReader in, PrintWriter out) {
    StringBuilder st = new StringBuilder(in.next());
    char prev = '#';
    int ans = 0;
    int cnt = 1;
    for (int i = 0; i < st.length(); ++i) {
      char cur = st.charAt(i);
      if (cur == prev) {
        ++cnt;
      } else {
        if (cnt % 2 == 0) {
          ++ans;
        }
        cnt = 1;
      }
      prev = cur;
    }
    if (cnt % 2 == 0) {
      ++ans;
    }
    out.println(ans);
    out.close();
  }

  public static void main(String[] args) {
    solve(new InputReader(System.in), new PrintWriter(System.out));
  }
}


import java.util.Scanner;

public class _391A_GeneticEngineering {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        int ans = 0, cnt = 1;
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) == s.charAt(i - 1)) {
                cnt++;
            } else {
                if (cnt % 2 == 0) {
                    ans++;
                }//if
                cnt = 1;
            }//else
        }//for
        if (cnt % 2 == 0) {
            ans++;
        }//if
        System.out.println(ans);
    }//psvm
}//class


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

public class AMain {

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

            String input;
            input=br.readLine();
            char[] s = input.toCharArray();

            int curSeq = 1;
            char curChar = s[0];
            int result = 0;
            for(int i=1; i<s.length; i++){
                if (s[i] != curChar){
                    if (curSeq%2 == 0){
                        result++;
                    }
                    curChar = s[i];
                    curSeq = 1;
                } else {
                    curSeq++;
                }
            }
            if (curSeq%2 == 0){
                result++;
            }
            System.out.println(result);

        }catch(IOException io){
            io.printStackTrace();
        }
    }

}


import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;

/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
  private static BufferedReader br;
  private static StringTokenizer st;
  private static PrintWriter pw;

  public static void main(String[] args) throws IOException {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    //int qq = 1;
    int qq = Integer.MAX_VALUE;
    //int qq = readInt();
    for(int casenum = 1; casenum <= qq; casenum++)  {
      String s = nextToken();
      int ret = 0;
      for(int i = 0; i < s.length();) {
        int j = i+1;
        while(j < s.length() && s.charAt(i) == s.charAt(j)) {
          j++;
        }
        if(i%2 == j%2) {
          ret++;
        }
        i=j;
      }
      pw.println(ret);
    }
    pw.close();
  }

  private static void exitImmediately() {
    pw.close();
    System.exit(0);
  }

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

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

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

  private static String nextToken() throws IOException  {
    while(st == null || !st.hasMoreTokens())  {
      if(!br.ready()) {
        exitImmediately();
      }
      st = new StringTokenizer(br.readLine().trim());
    }
    return st.nextToken();
  }
}


/**
 * Created with IntelliJ IDEA.
 * User: den
 * Date: 2/16/14
 * Time: 9:02 PM
 * To change this template use File | Settings | File Templates.
 */

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

public class TaskA extends Thread {
    private void solve() throws IOException {
        String s = nextToken();
        s += 'X';
        int currentLength = 1;
        int ans = 0;
        for (int i = 1; i < s.length(); i++){
          if (s.charAt(i-1) == s.charAt(i)){
              currentLength++;
          } else{
              if (currentLength%2 == 0){
                   ans++;
              }
              currentLength = 1;
          }

        }

        out.println(ans);

    }

    public void run() {
        try {
            solve();
        } catch (Exception e) {
            System.out.println("System exiting....");
            e.printStackTrace();
            System.exit(888);
        } finally {
            out.flush();
            out.close();
        }
    }

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

    public TaskA() throws FileNotFoundException {
        //in = new BufferedReader(new FileReader("A-large.in"));
        //out = new PrintWriter(new File("A-large.out"));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        setPriority(Thread.MAX_PRIORITY);
    }

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer st;

    private int _int() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private double _double() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private long _long() throws IOException {
        return Long.parseLong(nextToken());
    }

    private char[] _chars() throws IOException {
        return nextToken().toCharArray();
    }

    private String nextToken() throws IOException {
        if (st == null || !st.hasMoreElements())
            st = new StringTokenizer(in.readLine(), " \t\r\n");
        return st.nextToken();
    }
}


import java.util.Scanner;

public class MAIN {

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

        int res = 0;
        if (s!=null && s.length()>1) {
            for (int i=0; i<s.length(); ) {
                int j = i+1;
                while (j<s.length() && s.charAt(j)==s.charAt(j-1)) {
                    j++;
                }
                if ((j-i)%2==0) res++;
                i = j;
            }
        }

        System.out.println(res);
    }

}


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

public class Solve6 {

    public static void main(String[] args) throws IOException {
        PrintWriter pw = new PrintWriter(System.out);
        new Solve6().solve(pw);
        pw.flush();
        pw.close();
    }

    public void solve(PrintWriter pw) throws IOException {
        FastReader sc = new FastReader();
        char[] c = sc.next().toCharArray();
        int l = 0, r = 0;
        int ans = 0;
        while (l < c.length) {
            while (r < c.length && c[r] == c[l]) {
                ++r;
            }
            if (((r - l) & 1) == 0) {
                ++ans;
            }
            l = r;
        }
        pw.println(ans);
    }

    static class FastReader {

        StringTokenizer st;
        BufferedReader br;

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

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

        public boolean hasNext() throws IOException {
            if (st != null && st.hasMoreTokens()) {
                return true;
            }
            String s = br.readLine();
            if (s == null || s.isEmpty()) {
                return false;
            }
            st = new StringTokenizer(s);
            return true;
        }

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

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

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

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


//package codeforces;
import java.util.*;
public class GeneticEngineering {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        String s=in.nextLine();
        int count=1;
        int insert=0;
        for(int i=0;i<s.length()-1;i++)
        {
            if(s.charAt(i)==s.charAt(i+1))
            {
                count++;
            }
            else
            {
                if(count%2==0)
                {
                    insert++;
                }
                count=1;
            }
        }
        if(count%2==0)
            insert++;
        System.out.println(insert);
    }
}


import java.io.*;
import java.util.*;
public class GeneticEngineering
{
    public static void main(String[] args) throws IOException
    {
        //BufferedReader in = new BufferedReader(new FileReader("Sample Input.txt"));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String line = in.readLine();
        int same=1, ins=0;
        for (int i = 1; i < line.length(); i++)
        {
           if ( line.charAt(i) == line.charAt(i-1)) same++;
           else
           {
               if ( same%2 == 0)ins++;
               same=1;
           }
        }
        if ( same%2 == 0) ins++;
        System.out.println(ins);
    }

}


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

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

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        String str = in.next();
        int left = 0;
        int result = 0;
        while (left < str.length()) {
            int end = left + 1;
            while (end < str.length() && str.charAt(left) == str.charAt(end)) {
                end++;
            }

            result += (end - left + 1) % 2;
            left = end;
        }

        out.println(result);
    }

}

class InputReader {
    private BufferedReader reader;
    private String[] currentArray;

    public InputReader(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
    }

    public String next() {
        try {
            currentArray = null;
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

}


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

public class CF_1204E {
    public static void main(String args[]) throws Exception {
        BufferedScanner in = new BufferedScanner(System.in);
        BufferedPrinter out = new BufferedPrinter(System.out);

        long MOD = 998244853;
        int n = in.nextInt(), m = in.nextInt();

        long[][] zs = new long[n + 1][m + 1];
        for (int i = 0; i <= m; i++) zs[0][i] = 1;

        for (int i = 1; i <= n; i++) {
            for (int j = i; j <= m; j++) {
                zs[i][j] = zs[i][j - 1] + zs[i - 1][j];
                zs[i][j] %= MOD;
            }
        }

        long[][] tots = new long[n + 1][m + 1];
        for (int i = 0; i <= m; i++) tots[0][i] = 1;
        for (int i = 0; i <= n; i++) tots[i][0] = 1;

        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= m; j++){
                tots[i][j] = tots[i-1][j] + tots[i][j-1];
                tots[i][j] %= MOD;
            }
        }

        long[][] dp = new long[n + 1][m + 1];
        for (int i = 1; i <= n; i++) dp[i][0] = i;

        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                dp[i][j] = tots[i-1][j] - tots[i][j-1] + zs[i][j - 1] + dp[i][j - 1] + dp[i - 1][j];
                dp[i][j] += MOD;
                dp[i][j] %= MOD;
            }
        }
        out.println(dp[n][m]);

        out.close();
        in.close();
    }

    /**
     * My template below. FastIO and utility functions.
     * Minimized with https://codebeautify.org/javaviewer.
     */

    // @formatter:off
    static<T>ArrayList<ArrayList<T>>get2D(int n){ArrayList<ArrayList<T>>ret=new ArrayList<>();for(int i=0;i<n;i++)ret.add(new ArrayList<>());return ret;}
    static void force(boolean condition){if(!condition)throw new IllegalStateException();}
    static int debugCounter=0;static void debug(Object obj){debug(obj,"#"+debugCounter++ +": ");}
    static void debug(Object obj,String msg){System.out.println(msg);if(obj instanceof long[][]){for(long[]a:(long[][])obj)System.out.println(Arrays.toString(a));}
    if(obj instanceof int[][]){for(int[]a:(int[][])obj)System.out.println(Arrays.toString(a));}}
    static class BufferedPrinter{PrintWriter out;BufferedPrinter(OutputStream out){this(new OutputStreamWriter(out));}
    BufferedPrinter(Writer out){this.out=new PrintWriter(new BufferedWriter(out));}
    void print(Object...os){for(int i=0;i<os.length;i++){if(i!=0)out.print(' ');out.print(os[i]);}}
    void println(Object...os){print(os);out.println();}
    void close(){out.close();}
    void flush(){out.flush();}}
    static class BufferedScanner{private final InputStream in;private final byte[]buf=new byte[1<<13];int pos,count;BufferedScanner(InputStream in)throws IOException{this.in=in;}
    long nextLong()throws IOException{return Long.parseLong(next());}
    int[]nextN(int n)throws IOException{int[]ret=new int[n];for(int i=0;i<n;i++)ret[i]=this.nextInt();return ret;}
    long[]nextNL(int n)throws IOException{long[]ret=new long[n];for(int i=0;i<n;i++)ret[i]=this.nextLong();return ret;}
    private int read(){if(count==-1)err();try{if(pos>=count){pos=0;count=in.read(buf);if(count<=0)return-1;}}catch(IOException e){err();}
    return buf[pos++];}
    private static boolean isSpace(int c){return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;}
    private int readSkipSpace(){int ret;do{ret=read();}while(isSpace(ret));return ret;}
    int nextInt(){int sign=1;int c=readSkipSpace();if(c=='-'){sign=-1;c=read();}
    int ret=0;do{if(c<'0'||c>'9')err();ret=ret*10+c-'0';c=read();}while(!isSpace(c));return sign*ret;}
    String next(){StringBuilder sb=new StringBuilder();int c=readSkipSpace();do{sb.append((char)c);c=read();}while(!isSpace(c));return sb.toString();}
    private void err(){throw new InputMismatchException();}
    void close()throws IOException{in.close();}}
    // @formatter:on
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Saransh
 */
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        try
        {
            Parserdoubt pd=new Parserdoubt(System.in);
            PrintWriter pw=new PrintWriter(System.out);
            int n=pd.nextInt();
            int m=pd.nextInt();
            int start=pd.nextInt()-1;
            int end=pd.nextInt()-1;
            //same line
            int firstline=start/m;
            int lastline=end/m;
            int ans;
            if(firstline==lastline)
            {
                ans=1;
            }
            else if(start%m==0&&(end+1)%m==0)
            {
                ans=1;
            }
            else if(start%m==0&&(end+1)%m!=0)
            {
                ans=2;
                if(end+1==n)
                    ans--;
            }
            else if(start%m!=0&&(end+1)%m==0)
            {
                ans=2;
            }
            else if(lastline-firstline==1)
            {
                ans=2;
            }
            else if((start%m)-1==(end)%m)
            {
                ans=2;
            }
            else
            {
                ans=3;
                if(end+1==n)
                    ans--;
            }
            pw.println(ans);
            pw.flush();

        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

    }
/*int n=pd.nextInt();
            int m=pd.nextInt();
            int start=pd.nextInt()-1;
            int end=pd.nextInt()-1;
            //same line
            int firstline=start/m;
            int lastline=end/m;
            if(firstline==lastline)
            {
                pw.println(1);
            }
            else if(start%m==0&&(end+1)%m==0)
            {
                pw.println(1);
            }
            else if(start%m==0&&(end+1)%m!=0)
            {
                pw.println(2);
            }
            else if(start%m!=0&&(end+1)%m==0)
            {
                pw.println(2);
            }
            else if(lastline-firstline==1)
            {
                pw.println(2);
            }
            else
            {
                pw.println(3);
            }
            pw.flush();*/
}

class Parserdoubt
	{
	   final private int BUFFER_SIZE = 1 << 17;

	   private DataInputStream din;
	   private byte[] buffer;
	   private int bufferPointer, bytesRead;

	   public Parserdoubt(InputStream in)
	   {
	      din = new DataInputStream(in);
	      buffer = new byte[BUFFER_SIZE];
	      bufferPointer = bytesRead = 0;
	   }
	   public String nextString() throws Exception
	   {
		   StringBuffer sb=new StringBuffer("");
		   byte c = read();
		   while (c <= ' ') c = read();
		   do
		   {
			   sb.append((char)c);
			   c=read();
		   }while(c>' ');
		   return sb.toString();
	   }
	   public char nextChar() throws Exception
	   {
		   byte c=read();
		   while(c<=' ') c= read();
		   return (char)c;
	   }
	   public int nextInt() throws Exception
	   {
	      int ret = 0;
	      byte c = read();
	      while (c <= ' ') c = read();
	      boolean neg = c == '-';
	      if (neg) c = read();
	      do
	      {
	    	  ret = ret * 10 + c - '0';
	         c = read();
	      } while (c > ' ');
	      if (neg) return -ret;
	      return ret;
	   }
	   public long nextLong() throws Exception
	   {
	      long ret = 0;
	      byte c = read();
	      while (c <= ' ') c = read();
	      boolean neg = c == '-';
	      if (neg) c = read();
	      do
	      {
	    	  ret = ret * 10 + c - '0';
	         c = read();
	      } while (c > ' ');
	      if (neg) return -ret;
	      return ret;
	   }
	   private void fillBuffer() throws Exception
	   {
	      bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
	      if (bytesRead == -1) buffer[0] = -1;
	   }

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


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

public class H {
    FastScanner in;
    PrintWriter out;

    public static final long P = 1_000_000_007;

    public void solve() throws IOException {
        long n = in.nextInt() + 1;
        long s = 1;
        long s2 = 1;
        for (long i = 1; i <= n; i++) {
            s = (s * i) % P;
        }
        for (long i = 1; i <= 2 * n; i++) {
            s2 = (s2 * i) % P;
        }
        long m = BigInteger.valueOf(s).modPow(BigInteger.valueOf(P - 2), BigInteger.valueOf(P)).longValue();
        out.println((((s2 * m) % P )* m  + P - 1) % P);
    }

    public void run() {
        try {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);
            Locale.setDefault(Locale.US);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

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

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

    public static void main(String[] arg) {
        new H().run();
    }
}


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

public class C {
	static int[] openCost, closedCost;
	static int[][][] dp;
	static int inf = 10000000;

	public static int solve(int curCost, int endCost, int remMoves) {
		if (remMoves == openCost.length) {
			if (curCost == endCost) {
				return 0;
			}
			return inf;
		}
		if (dp[curCost][endCost][remMoves] != -1) {
			return dp[curCost][endCost][remMoves];
		}
		int min = Integer.MAX_VALUE;
		if (curCost > 0) {
			if (curCost < 2 * openCost.length) {
				min = Math.min(
						openCost[remMoves]
								+ solve(curCost + 1, endCost, remMoves + 1),
						closedCost[remMoves]
								+ solve(curCost - 1, endCost, remMoves + 1));
			} else {
				min = Math.min(
						min,
						closedCost[remMoves]
								+ solve(curCost - 1, endCost, remMoves + 1));
			}
		} else {
			min = Math.min(
					min,
					openCost[remMoves]
							+ solve(curCost + 1, endCost, remMoves + 1));
		}
		return dp[curCost][endCost][remMoves] = min;
	}

	public static int[][] getOpt(int[][] mat1, int[][] mat2) {
		int[][] res = new int[mat1.length][mat2.length];
		for (int i = 0; i < mat1.length; i++) {
			for (int j = 0; j < mat1.length; j++) {
				res[i][j] = Integer.MAX_VALUE;
				for (int k = 0; k < mat1.length; k++) {
					res[i][j] = Math.min(res[i][j], mat1[i][k] + mat2[k][j]);
				}
			}
		}
		return res;
	}

	public static void main(String[] args) throws Exception {
		int n = nextInt();
		int m = nextInt();
		openCost = new int[n];
		closedCost = new int[n];
		for (int i = 0; i < n; i++) {
			openCost[i] = nextInt();
		}
		for (int i = 0; i < n; i++) {
			closedCost[i] = nextInt();
		}
		dp = new int[2 * n + 1][2 * n + 1][n];
		for (int i = 0; i < dp.length; i++) {
			for (int j = 0; j < dp[0].length; j++) {
				Arrays.fill(dp[i][j], -1);
			}
		}
		int[][] costMatrix = new int[2 * n + 1][2 * n + 1];
		for (int i = 0; i <= 2 * n; i++) {
			for (int j = 0; j <= 2 * n; j++) {
				costMatrix[i][j] = solve(i, j, 0);
			}
		}
//		for(int i=0;i<costMatrix.length;i++){
//			System.out.println(Arrays.toString(costMatrix[i]));
//		}
		int[][] res = new int[2 * n + 1][2 * n + 1];
		for (int i = 0; i < 2 * n + 1; i++) {
			Arrays.fill(res[i], 1000000000);
		}
		for (int i = 0; i < 2 * n + 1; i++) {
			res[i][i] = 0;
		}
		while (m > 0) {
			if ((m & 1) == 1) {
				res = getOpt(res, costMatrix);
			}
			costMatrix = getOpt(costMatrix, costMatrix);
			m >>= 1;
		}
		System.out.println(res[0][0]);
	}

	static BufferedReader br = new BufferedReader(new InputStreamReader(
			System.in));
	static StringTokenizer tokenizer = new StringTokenizer("");

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

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

	static String next() throws Exception {
		while (true) {
			if (tokenizer.hasMoreTokens()) {
				return tokenizer.nextToken();
			}
			String s = br.readLine();
			if (s == null) {
				return null;
			}
			tokenizer = new StringTokenizer(s);
		}
	}
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C119P2 {

    private static BufferedReader in;
    private static PrintWriter out;
    private static StringTokenizer input;

    public static void main(String[] args) throws IOException {
        //-------------------------------------------------------------------------
        //Initializing...
        new C119P2();
        //-------------------------------------------------------------------------
        //put your code here... :)
        int w = nextInt();
        int h = nextInt();
        long [][] dp = new long[w+1][h+1];
        for (int i = 2; i < dp.length; i++) {
            for (int j = 2; j < dp[i].length; j++) {
                dp[i][j] = dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+(i/2)*(j/2);
            }
        }
        writeln(""+dp[w][h]);
        //-------------------------------------------------------------------------
        //closing up
        end();
        //--------------------------------------------------------------------------

    }

    public C119P2() throws IOException {
        //Input Output for Console to be used for trying the test samples of the problem
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        //-------------------------------------------------------------------------
        //Initalize Stringtokenizer input
        input = new StringTokenizer(in.readLine());
    }

    private static int nextInt() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Integer.parseInt(input.nextToken());
    }
    private static long nextLong() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Long.parseLong(input.nextToken());
    }
    private static double nextDouble() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Double.parseDouble(input.nextToken());
    }
    private static String nextString() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return input.nextToken();
    }
    private static void write(String output){
        out.write(output);
        out.flush();
    }
    private static void writeln(String output){
        out.write(output+"\n");
        out.flush();
    }
    private static void end() throws IOException{
        in.close();
        out.close();
        System.exit(0);
    }

}


//package hel2018;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class E1 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int R = ni(), B = ni();
		if(R != B){
			out.println("No");
			return;
		}
		int[][] cor = new int[R][];
		int[][] cob = new int[B][];
		for(int i = 0;i < R;i++){
			cor[i] = na(2);
		}
		for(int i = 0;i < B;i++){
			cob[i] = na(2);
		}
		int n = R;
		int[] ord = new int[n];
		for(int i = 0;i < n;i++)ord[i] = i;
		outer:
		do{
			for(int i = 0;i < n;i++){
				for(int j = i+1;j < n;j++){
					if(hasCommonPoint(cor[i], cob[ord[i]], cor[j], cob[ord[j]]))continue outer;
				}
			}
			out.println("Yes");
			return;
		}while(nextPermutation(ord));
		out.println("No");
	}

	public static boolean hasCommonPoint(long ax, long ay, long bx, long by, long cx, long cy, long dx, long dy)
	{
		long c1 = (cx-ax)*(by-ay)-(cy-ay)*(bx-ax);
		long c2 = (dx-ax)*(by-ay)-(dy-ay)*(bx-ax);
		if(c1 < 0 && c2 < 0 || c1 > 0 && c2 > 0)return false;
		long d1 = (ax-cx)*(dy-cy)-(ay-cy)*(dx-cx);
		long d2 = (bx-cx)*(dy-cy)-(by-cy)*(dx-cx);
		if(d1 < 0 && d2 < 0 || d1 > 0 && d2 > 0)return false;
		if(c1 == 0 && c2 == 0 && d1 == 0 && d2 == 0){
			if(ax == bx && ay == by){
				return (cx-ax)*(dx-ax)+(cy-ay)*(dy-ay) <= 0;
			}else{
				long posc = (cx-ax)*(bx-ax)+(cy-ay)*(by-ay);
				long posd = (dx-ax)*(bx-ax)+(dy-ay)*(by-ay);
				long den = (bx-ax)*(bx-ax)+(by-ay)*(by-ay);
	//			return Math.max(0, Math.min(posc, posd)) <= Math.min(den, Math.max(posc, posd));
	//			return Math.min(posc, posd) <= den && 0 <= Math.max(posc, posd);
				return (posc <= den || posd <= den) && (0 <= posc || 0 <= posd);
			}
		}
		return true;
	}

	public static boolean hasCommonPoint(int[] a, int[] b, int[] c, int[] d){ return hasCommonPoint(a[0], a[1], b[0], b[1], c[0], c[1], d[0], d[1]);}
	public static boolean hasCommonPoint(long[] a, long[] b, long[] c, long[] d){ return hasCommonPoint(a[0], a[1], b[0], b[1], c[0], c[1], d[0], d[1]);}

	public static boolean nextPermutation(int[] a) {
		int n = a.length;
		int i;
		for (i = n - 2; i >= 0 && a[i] >= a[i + 1]; i--)
			;
		if (i == -1)
			return false;
		int j;
		for (j = i + 1; j < n && a[i] < a[j]; j++)
			;
		int d = a[i];
		a[i] = a[j - 1];
		a[j - 1] = d;
		for (int p = i + 1, q = n - 1; p < q; p++, q--) {
			d = a[p];
			a[p] = a[q];
			a[q] = d;
		}
		return true;
	}

	void run() throws Exception
	{
//		int n = 10, m = 99999;
//		Random gen = new Random();
//		StringBuilder sb = new StringBuilder();
//		sb.append(n + " ");
//		sb.append(n + " ");
//		for (int i = 0; i < n*4; i++) {
//			sb.append(gen.nextInt(20)-10 + " ");
//		}
//		INPUT = sb.toString();

		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

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

	public static void main(String[] args) throws Exception { new E1().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 boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


import java.util.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
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);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, FastScanner in, FastPrinter out) {
        int x1 = in.nextInt();
        int y1 = in.nextInt();
        int x2 = in.nextInt();
        int y2 = in.nextInt();
        int x3 = in.nextInt();
        int y3 = in.nextInt();
        for (int rot = 0; rot < 4; rot++) {
            if (canSolve(x2 - x1, y2 - y1, x3, y3)) {
                out.println("YES");
                return;
            }
            int nx1 = -y1;
            int ny1 = x1;
            x1 = nx1;
            y1 = ny1;
        }
        out.println("NO");
    }

    static boolean canSolve(int x1, int y1, int x2, int y2) {
        if (x2 == 0 && y2 == 0) {
            return x1 == 0 && y1 == 0;
        }
        long a1 = x2;
        long b1 = -y2;
        long c1 = x1;
        long a2 = y2;
        long b2 = x2;
        long c2 = y1;
        long z = a1 * b2 - a2 * b1;
        long dx = b1 * c2 - c1 * b2;
        long dy = c1 * a2 - a1 * c2;
        if (z == 0) {
            if (dx != 0 || dy != 0) {
                return false;
            }
            return c1 % MathUtils.gcd(Math.abs(a1), Math.abs(b1)) == 0;
        }
        return dx % z == 0 && dy % z == 0;
    }
}

class FastScanner extends BufferedReader {

    boolean isEOF;

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

    static boolean isWhiteSpace(int c) {
        return c >= -1 && 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 (!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;
    }

    }

class FastPrinter extends PrintWriter {

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

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

}

class MathUtils {

    public static long gcd(long a, long b) {
        while (b != 0) {
            long t = a % b;
            a = b;
            b = t;
        }
        return a;
    }

    }


// practice with kaiboy
import java.io.*;
import java.util.*;

public class CF27E extends PrintWriter {
	CF27E() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF27E o = new CF27E(); o.main(); o.flush();
	}

	static final long INF = 0x3f3f3f3f3f3f3f3fL;
	long ans = INF;
	int[] pp = { 2, 3, 5, 7, 11, 13, 17, 19, 23 };
	void solve(int n, int b, int i, long m) {
		if (n == 1) {
			ans = Math.min(ans, m);
			return;
		}
		int p = pp[i];
		for (int a = 2; a <= b && m <= INF / p; a++, m *= p)
			if (n % a == 0)
				solve(n / a, a, i + 1, m * p);
	}
	void main() {
		int n = sc.nextInt();
		solve(n, 60, 0, 1);
		println(ans);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer;

public class GregandFriends {
    static long[][] C;

    public static long[][] C(int MAX) {
        long C[][] = new long[MAX + 1][MAX + 1];
        for (int i = 0; i < C.length; i++)
            C[i][0] = 1;
        for (int i = 1; i < C.length; i++)
            C[0][i] = 0;
        for (int i = 1; i < C.length; i++)
            for (int j = 1; j < C[i].length; j++)
                C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
        return C;
    }

    static int k;
    static long[][][] dp;
    static int[][][] dist;
    static int c1, c2;
    static long MOD = 1000000007;

    public static long modMul(long a, long b, long c) {
        return (((a * b) % MOD) * c) % MOD;
    }

    public static long go(int p, int ci, int cj) {
        if (ci == c1 && cj == c2 && p == 1)
            return 1;
        long ret = 0;
        if (dp[p][ci][cj] != -1) {
            return dp[p][ci][cj];
        }
        for (int i = 0; i * 50 <= k && i <= ci; i++) {
            for (int j = 0; i * 50 + j * 100 <= k && j <= cj; j++) {
                if (i == 0 && j == 0)
                    continue;
                int nexti = c1 - ci + i;
                int nextj = c2 - cj + j;
                int nextp = p ^ 1;
                if (dist[nextp][nexti][nextj] == dist[p][ci][cj] + 1) {
                    ret = (ret + modMul(C[ci][i], C[cj][j],
                            go(nextp, nexti, nextj)))
                            % MOD;
                }
            }
        }
        return dp[p][ci][cj] = ret;
    }

    public static void main(String[] args) throws Exception {
        InputReader in = new InputReader(System.in);
        int n = in.nextInt();
        k = in.nextInt();
        dist = new int[2][n + 1][n + 1];
        for (int[][] a : dist)
            for (int[] b : a)
                Arrays.fill(b, 1 << 20);
        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
            if (x == 50)
                c1++;
            else
                c2++;
        }
        C = C(52);
        dist[0][c1][c2] = 0;
        dp = new long[2][n + 1][n + 1];
        for (long[][] a : dp)
            for (long[] b : a)
                Arrays.fill(b, -1);
        Queue<int[]> Q = new ArrayDeque<int[]>();
        Q.add(new int[] { 0, c1, c2 });
        while (!Q.isEmpty()) {
            int[] state = Q.poll();
            // System.out.println(Arrays.toString(state));
            int cp = state[0];
            int ci = state[1];
            int cj = state[2];
            for (int i = 0; i * 50 <= k && i <= ci; i++) {
                for (int j = 0; i * 50 + j * 100 <= k && j <= cj; j++) {
                    if (i == 0 && j == 0)
                        continue;
                    int nexti = c1 - ci + i;
                    int nextj = c2 - cj + j;
                    int nextp = cp ^ 1;
                    if (dist[nextp][nexti][nextj] == 1 << 20) {
                        dist[nextp][nexti][nextj] = 1 + dist[cp][ci][cj];
                        Q.add(new int[] { nextp, nexti, nextj });
                    }
                }
            }
        }
        if (dist[1][c1][c2] == 1 << 20) {
            System.out.println(-1);
            System.out.println(0);
        } else {
            System.out.println(dist[1][c1][c2]);
            System.out.println(go(0, c1, c2));
        }
    }

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

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

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

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


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

public class C_new {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	int cnt1, cnt2;

	int getV(int c1, int c2, int side) {
		return c1 + c2 * (cnt1 + 1) + side * (cnt1 + 1) * (cnt2 + 1);
	}

	static final int MOD = 1000000007;
	static final int INF = Integer.MAX_VALUE / 3;

	class Edge {
		int to, ways;

		public Edge(int to, int ways) {
			this.to = to;
			this.ways = ways;
		}
	}

	int[][] arrC;

	void makeC(int n) {
		arrC = new int[n + 1][];
		for (int i = 0; i <= n; i++) {
			arrC[i] = new int[i + 1];
			arrC[i][0] = arrC[i][i] = 1;
			for (int j = 1; j < i; j++) {
				arrC[i][j] = arrC[i - 1][j - 1] + arrC[i - 1][j];
				if (arrC[i][j] >= MOD)
					arrC[i][j] -= MOD;
			}
		}
	}

	int c(int n, int k) {
		if (n < 0 || k < 0 || k > n)
			return 0;
		return arrC[n][k];
	}

	ArrayList<Edge>[] g;
	int N;

	void solve() throws IOException {
		int n = nextInt();
		int sz = nextInt() / 50;

		cnt1 = 0;
		cnt2 = 0;
		for (int i = 0; i < n; i++) {
			int x = nextInt();
			if (x == 50)
				cnt1++;
			else
				cnt2++;
		}

		N = 2 * (cnt1 + 1) * (cnt2 + 1);

		makeC(Math.max(cnt1, cnt2));

		g = new ArrayList[N];
		for (int i = 0; i < N; i++) {
			g[i] = new ArrayList<>();
		}

		for (int left1 = 0; left1 <= cnt1; left1++) {
			for (int left2 = 0; left2 <= cnt2; left2++) {
				// from left to right
				int v = getV(left1, left2, 0);

				for (int send1 = 0; send1 <= left1 && send1 <= sz; send1++) {
					for (int send2 = 0; send2 <= left2
							&& send1 + 2 * send2 <= sz; send2++) {
						if (send1 + send2 == 0)
							continue;
						int ways = (int) ((long) c(left1, send1)
								* c(left2, send2) % MOD);
						// System.err.println(left1 + " " + left2 + " -> " +
						// send1
						// + " " + send2);
						g[v].add(new Edge(
								getV(left1 - send1, left2 - send2, 1), ways));
					}
				}

				v = getV(left1, left2, 1);
				// from right to left
				for (int send1 = 0; send1 <= cnt1 - left1 && send1 <= sz; send1++) {
					for (int send2 = 0; send2 <= cnt2 - left2
							&& send1 + 2 * send2 <= sz; send2++) {
						if (send1 + send2 == 0)
							continue;
						int ways = (int) ((long) c(cnt1 - left1, send1)
								* c(cnt2 - left2, send2) % MOD);
						// System.err.println(left1 + " " + left2 + " -> " +
						// send1
						// + " " + send2);
						g[v].add(new Edge(
								getV(left1 + send1, left2 + send2, 0), ways));
					}
				}
			}
		}
		int st = getV(cnt1, cnt2, 0);
		int en = getV(0, 0, 1);

		int[] d = new int[N];
		Arrays.fill(d, INF);
		d[st] = 0;

		int[] ways = new int[N];
		ways[st] = 1;

		ArrayDeque<Integer> q = new ArrayDeque<>();
		q.add(st);
		while (!q.isEmpty()) {
			int v = q.poll();
			for (int i = 0; i < g[v].size(); i++) {
				Edge e = g[v].get(i);
				if (d[e.to] > d[v] + 1) {
					d[e.to] = d[v] + 1;
					ways[e.to] = 0;
					q.add(e.to);
				}
				if (d[e.to] == d[v] + 1) {
					ways[e.to] += (int) ((long) ways[v] * e.ways % MOD);
					if (ways[e.to] >= MOD)
						ways[e.to] -= MOD;
				}
			}
		}

		if (d[en] == INF) {
			out.println(-1);
			out.println(0);
		} else {
			out.println(d[en]);
			out.println(ways[en]);
		}

	}

	C_new() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

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

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

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

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

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


import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.math.*;
import java.awt.geom.*;

import static java.lang.Math.*;

public class Solution implements Runnable {

	static final int MOD = 1000000007;

	class State {

		int boat, c50, c100;

		public State(int boat, int c50, int c100) {
			this.boat = boat;
			this.c50 = c50;
			this.c100 = c100;
		}

	}

	public void solve() throws Throwable {
		int n = sc.nextInt();
		int w = sc.nextInt();
		int count50 = 0, count100 = 0;
		for (int i = 0; i < n; i++) {
			int num = sc.nextInt();
			if (num == 50)
				count50++;
			else
				count100++;
		}

		int dist [][][] = new int [2][count50 + 1][count100 + 1];
		for (int i = 0; i < 2; i++)
			for (int j = 0; j <= count50; j++)
				for (int k = 0; k <= count100; k++)
					dist[i][j][k] = Integer.MAX_VALUE / 2;
		dist[0][0][0] = 0;
		ArrayDeque<State> q = new ArrayDeque<>();
		q.add(new State(0, 0, 0));
		while (!q.isEmpty()) {
			State cur = q.poll();
			int boat = cur.boat;
			int c50 = cur.c50;
			int c100 = cur.c100;
			if (cur.boat == 0) {
				for (int to50 = 0; to50 <= count50 - c50 && 50 * to50 <= w; to50++)
					for (int to100 = 0; to100 <= count100 - c100 && 50 * to50 + 100 * to100 <= w; to100++) {
						if (to50 == 0 && to100 == 0) continue;
						if (dist[boat ^ 1][c50 + to50][c100 + to100] > dist[boat][c50][c100] + 1) {
							dist[boat ^ 1][c50 + to50][c100 + to100] = dist[boat][c50][c100] + 1;
							q.add(new State(boat ^ 1, c50 + to50, c100 + to100));
						}
					}
			} else {
				for (int to50 = 0; to50 <= c50 && 50 * to50 <= w; to50++)
					for (int to100 = 0; to100 <= c100 && 50 * to50 + 100 * to100 <= w; to100++) {
						if (to50 == 0 && to100 == 0) continue;
						if (dist[boat ^ 1][c50 - to50][c100 - to100] > dist[boat][c50][c100] + 1) {
							dist[boat ^ 1][c50 - to50][c100 - to100] = dist[boat][c50][c100] + 1;
							q.add(new State(boat ^ 1, c50 - to50, c100 - to100));
						}
					}
			}
		}
		if (dist[1][count50][count100] == Integer.MAX_VALUE / 2) {
			out.println(-1);
			out.println(0);
			return;
		}
		out.println(dist[1][count50][count100]);

		long c [][] = new long [n + 1][n + 1];
		for (int i = 0; i <= n; i++) {
			c[i][0] = c[i][i] = 1;
			for (int j = 1; j < i; j++)
				c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
		}

		int d = dist[1][count50][count100];
		long sum[][][] = new long[2][count50 + 1][count100 + 1];
		sum[1][count50][count100] = 1;
		for (int distance = d; distance > 0; distance--) {
			// boat 0
			for (int c50 = 0; c50 <= count50; c50++)
				for (int c100 = 0; c100 <= count100; c100++)
					if (dist[0][c50][c100] == distance) {
						for (int to50 = 0; to50 <= count50 - c50 && 50 * to50 <= w; to50++)
							for (int to100 = 0; to100 <= count100 - c100 && 50 * to50 + 100 * to100 <= w; to100++) {
								if (to50 == 0 && to100 == 0) continue;
								if (dist[1][c50 + to50][c100 + to100] == dist[0][c50][c100] - 1) {
									long multiplier = (c[count50 - c50][to50] * c[count100 - c100][to100]) % MOD;
									multiplier = (multiplier * sum[0][c50][c100]) % MOD;
									sum[1][c50 + to50][c100 + to100] += multiplier;
									sum[1][c50 + to50][c100 + to100] %= MOD;
								}
							}
					}
			for (int c50 = 0; c50 <= count50; c50++)
				for (int c100 = 0; c100 <= count100; c100++)
					if (dist[1][c50][c100] == distance) {
						for (int to50 = 0; to50 <= c50 && 50 * to50 <= w; to50++)
							for (int to100 = 0; to100 <= c100 && 50 * to50 + 100 * to100 <= w; to100++) {
								if (to50 == 0 && to100 == 0) continue;
								if (dist[0][c50 - to50][c100 - to100] == dist[1][c50][c100] - 1) {
									long multiplier = (c[c50][to50] * c[c100][to100]) % MOD;
									multiplier = (multiplier * sum[1][c50][c100]) % MOD;
									sum[0][c50 - to50][c100 - to100] += multiplier;
									sum[0][c50 - to50][c100 - to100] %= MOD;
								}
							}
					}

		}
		out.println(sum[0][0][0]);
	}

	BufferedReader in;
	PrintWriter out;
	FastScanner sc;

	static Throwable uncaught;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable t) {
			Solution.uncaught = t;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread t = new Thread(null, new Solution(), "", (1 << 26));
		t.start();
		t.join();
		if (uncaught != null) {
			throw uncaught;
		}
	}

}

class FastScanner {

	BufferedReader reader;
	StringTokenizer strTok;

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

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

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

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

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

}

class Treap {

	static Random rnd = new Random();

	long x, sum, pairSum;
	int prior, cnt;
	Treap l, r;

	public Treap(long x) {
		this.x = x;
		this.sum = x;
		this.pairSum = 0;
		this.cnt = 1;
		this.prior = rnd.nextInt();
	}

	public static long getSum (Treap t) {
		return t == null ? 0 : t.sum;
	}

	public static long getPairSum (Treap t) {
		return t == null ? 0 : t.pairSum;
	}

	public static int getCount (Treap t) {
		return t == null ? 0 : t.cnt;
	}

	public static void updateVertex (Treap t) {
		if (t == null) return;
		t.cnt = getCount(t.l) + getCount(t.r) + 1;
		t.sum = getSum(t.l) + getSum(t.r) + t.x;
		t.pairSum = getPairSum(t.l) + getPairSum(t.r);
		if (t.l != null)
			t.pairSum += t.x * getCount(t.l) - getSum(t.l);
		if (t.r != null)
			t.pairSum += getSum(t.r) - t.x * getCount(t.r);
		if (t.l != null && t.r != null)
			t.pairSum += getSum(t.r) * getCount(t.l) - getSum(t.l) * getCount(t.r);
	}

	public static Treap merge (Treap l, Treap r) {
		if (l == null) return r;
		if (r == null) return l;
		if (l.prior > r.prior) {
			l.r = merge (l.r, r);
			updateVertex(l);
			return l;
		} else {
			r.l = merge (l, r.l);
			updateVertex(r);
			return r;
		}
	}

	public static Treap [] split (Treap t, long key) {
		if (t == null) return new Treap [] {null, null};
		Treap[] res = null;
		if (key <= t.x) {
			res = split (t.l, key);
			t.l = res[1];
			res[1] = t;
		} else {
			res = split (t.r, key);
			t.r = res[0];
			res[0] = t;
		}
		updateVertex(res[0]);
		updateVertex(res[1]);
		return res;
	}

	public static void dfs (Treap t, StringBuilder sb) {
		if (t == null) return;
		dfs (t.l, sb);
		sb.append(t.x);
		sb.append(" ");
		dfs (t.r, sb);
	}

}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class C295 {
	static class FastScanner {
		BufferedReader reader;
		StringTokenizer tokens;

		public FastScanner(File file) throws FileNotFoundException {
			reader = new BufferedReader(new FileReader(file));
		}

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}

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

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

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

		public boolean hasNextToken() {
			while (tokens == null || !tokens.hasMoreTokens()) {
				try {
					tokens = new StringTokenizer(reader.readLine());
				} catch (Exception e) {
					return false;
				}
			}
			return true;
		}

		public void close() {
			try {
				reader.close();
			} catch (IOException e) {
			}
		}
	}

	static int[][][][] d;
	static int[][] C;
	static int slim = 0;
	static int fat = 0;
	static int k;

	public static int get(int boat, int i, int j, int n) {
		if (i < 0 || j < 0 || n < 0) {
			return 0;
		}
		if (d[boat][i][j][n] != 0) {
			return d[boat][i][j][n] - 1;
		}
		if (n == 0) {
			if (i == 0 && j == 0) {
				d[boat][i][j][0] = 2;
			} else {
				d[boat][i][j][0] = 1;
			}
			return d[boat][i][j][0] - 1;
		}
		d[boat][i][j][n] = 1;
		long delta = 0;
		if (boat == 1) {
			for (int countSlim = 0; countSlim <= i; countSlim++) {
				for (int countFat = 0; countFat <= j && countSlim + 2 * countFat <= k; countFat++) {
					if (countFat + countSlim > 0) {
						delta = ((long)get(0,i - countSlim, j - countFat, n - 1) * (C[slim - i + countSlim][countSlim])) % 1000000007;
						delta = (delta * C[fat - j + countFat][countFat]) % 1000000007;
						d[boat][i][j][n] = (int)((d[boat][i][j][n] + delta) % 1000000007);
					}
				}
			}
		} else {
			for (int countSlim = 0; countSlim <= slim - i; countSlim++) {
				for (int countFat = 0; countFat <= fat - j && countSlim + 2 * countFat <= k; countFat++) {
					if (countFat + countSlim > 0) {
						delta = ((long)get(1, i + countSlim, j + countFat, n - 1) * (C[i + countSlim][countSlim])) % 1000000007;
						delta = (delta * C[j + countFat][countFat]) % 1000000007;
						d[boat][i][j][n] = (int)((d[boat][i][j][n] + delta) % 1000000007);
					}
				}
			}
		}
		return d[boat][i][j][n] - 1;
	}

	public static void main(String[] args) {
		FastScanner in  = new FastScanner(System.in);
		int n = in.nextInt();
		k = in.nextInt() / 50;
		for (int i = 0; i < n; i++) {
			if (in.nextInt() == 50) {
				slim++;
			} else {
				fat++;
			}
		}
		C = new int[Math.max(slim, fat) + 1][Math.max(slim, fat) + 1];
		d = new int[2][slim + 1][fat + 1][n * n + 2];
		for (int i = 0; i < Math.max(slim, fat) + 1; i++) {
			C[0][i] = 0;
			C[i][0] = 1;
		}
		for (int i = 1; i < Math.max(slim, fat) + 1; i++) {
			for (int j = 1; j < Math.max(slim, fat) + 1; j++) {
				C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % 1000000007;
			}
		}
		for (int i = 0; i < n * n + 2; i++) {
			if (get(1, slim, fat, i) != 0) {
				System.out.println(i);
				System.out.println(get(1, slim, fat, i));
				return;
			}
		}
		System.out.println(-1);
		System.out.println(0);
	}
}


import java.awt.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

import static java.lang.Math.max;
import static java.lang.Math.min;

public class C implements Runnable{

    // SOLUTION AT THE TOP OF CODE!!!
    // HACK ME PLEASE IF YOU CAN!!!
    // PLEASE!!!
    // PLEASE!!!
    // PLEASE!!!

    private final static boolean FIRST_INPUT_STRING = false;
    private final static boolean MULTIPLE_TESTS = true;
    private final boolean ONLINE_JUDGE = !new File("input.txt").exists();
//    private final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    private final static int MAX_STACK_SIZE = 128;

    private final static boolean OPTIMIZE_READ_NUMBERS = false;

    /////////////////////////////////////////////////////////////////////

    private final static Random rnd = new Random();
    private final static String fileName = "";

    private final static long MODULO = 1000 * 1000 * 1000 + 7;

    // THERE SOLUTION STARTS!!!
    private void solve() {
        int n = readInt(), k = readInt();
        int[] a = readIntArray(n);

        Point answer = getAnswer(n, a, k);

        out.println(answer.x);
        out.println(answer.y);
    }

    private Point getAnswer(int n, int[] a, int limit) {
        final int MULTIPLIER = 50;

        limit /= MULTIPLIER;

        for (int i = 0; i < n; ++i) a[i] /= MULTIPLIER;

        int onesCount = 0, twosCount = 0;
        for (int v : a) {
            if (v == 1) ++onesCount;
            else ++twosCount;
        }

        long[][] c = new long[n + 1][n + 1];
        for (int i = 0; i <= n; ++i) {
            c[i][0] = c[i][i] = 1;
            for (int j = 1; j < i; ++j) {
                c[i][j] = add(c[i - 1][j - 1], c[i - 1][j]);
            }
        }

        final int FROM_SIDE = 0, TO_SIDE = 1;
        final int INF = Integer.MAX_VALUE / 3;

        int[][][] distances = new int[2][onesCount + 1][twosCount + 1];
        for (int[][] d2 : distances) for (int[] d1 : d2) Arrays.fill(d1, INF);

        long[][][] ways = new long[2][onesCount + 1][twosCount + 1];

        distances[FROM_SIDE][onesCount][twosCount] = 0;
        ways[FROM_SIDE][onesCount][twosCount] = 1;

        class Triple {
            int side, ones, twos;

            public Triple(int side, int ones, int twos) {
                this.side = side;
                this.ones = ones;
                this.twos = twos;
            }
        }

        Queue<Triple> q = new ArrayDeque<>();
        q.add(new Triple(FROM_SIDE, onesCount, twosCount));

        while (q.size() > 0) {
            Triple from = q.poll();

            int fromDistance = distances[from.side][from.ones][from.twos];
            long fromWays = ways[from.side][from.ones][from.twos];
            int fromNextDistance = fromDistance + 1;

            int nextSide = FROM_SIDE + TO_SIDE - from.side;

            if (from.side == FROM_SIDE) {
                for (int deltaOnes = 0; deltaOnes <= from.ones; ++deltaOnes) {
                    for (int deltaTwos = 0; deltaTwos <= from.twos; ++deltaTwos) {
                        if (deltaOnes + deltaTwos == 0) continue;
                        if (deltaOnes + 2 * deltaTwos > limit) continue;

                        int nextOnes = from.ones - deltaOnes;
                        int nextTwos = from.twos - deltaTwos;

                        int nextDistance = distances[nextSide][nextOnes][nextTwos];

                        if (nextDistance < fromNextDistance) continue;

                        long fromNextWays = mult(fromWays,
                                mult(c[from.ones][deltaOnes], c[from.twos][deltaTwos])
                        );

                        if (nextDistance > fromNextDistance) {
                            nextDistance = distances[nextSide][nextOnes][nextTwos] = fromNextDistance;
                            q.add(new Triple(nextSide, nextOnes, nextTwos));
                        }

                        if (nextDistance == fromNextDistance) {
                            ways[nextSide][nextOnes][nextTwos] = add(
                                    ways[nextSide][nextOnes][nextTwos],
                                    fromNextWays
                            );
                        }
                    }
                }
            } else {
                int toOnes = onesCount - from.ones;
                int toTwos = twosCount - from.twos;

                for (int deltaOnes = 0; deltaOnes <= toOnes; ++deltaOnes) {
                    for (int deltaTwos = 0; deltaTwos <= toTwos; ++deltaTwos) {
                        if (deltaOnes + deltaTwos == 0) continue;
                        if (deltaOnes + 2 * deltaTwos > limit) continue;

                        int nextOnes = from.ones + deltaOnes;
                        int nextTwos = from.twos + deltaTwos;

                        int nextDistance = distances[nextSide][nextOnes][nextTwos];

                        if (nextDistance < fromNextDistance) continue;

                        long fromNextWays = mult(fromWays,
                                mult(c[toOnes][deltaOnes], c[toTwos][deltaTwos])
                        );

                        if (nextDistance > fromNextDistance) {
                            nextDistance = distances[nextSide][nextOnes][nextTwos] = fromNextDistance;
                            q.add(new Triple(nextSide, nextOnes, nextTwos));
                        }

                        if (nextDistance == fromNextDistance) {
                            ways[nextSide][nextOnes][nextTwos] = add(
                                    ways[nextSide][nextOnes][nextTwos],
                                    fromNextWays
                            );
                        }
                    }
                }
            }
        }

        int distance = distances[TO_SIDE][0][0];
        if (INF == distance) {
            return new Point(-1, 0);
        } else {
            return new Point(distance, (int)ways[TO_SIDE][0][0]);
        }
    }

    /////////////////////////////////////////////////////////////////////

    @SuppressWarnings("unused")
    private static long inverse(long x) {
        return binpow(x, MODULO - 2);
    }

    private static long binpow(long base, long power) {
        if (power == 0) return 1;
        if ((power & 1) == 0) {
            long half = binpow(base, power >> 1);
            return mult(half, half);
        } else {
            long prev = binpow(base, power - 1);
            return mult(prev, base);
        }
    }

    private static long add(long a, long b) { return (a + b) % MODULO; }

    @SuppressWarnings("unused")
    private static long subtract(long a, long b) { return add(a, MODULO - b % MODULO); }

    private static long mult(long a, long b) { return (a * b) % MODULO; }

    /////////////////////////////////////////////////////////////////////

    @SuppressWarnings("unused")
    void yesNo(boolean yes) {
        out.println(yes ? "YES" : "NO");
    }

    /////////////////////////////////////////////////////////////////////

    public void run(){
        try{
            timeInit();
            Locale.setDefault(Locale.US);

            init();

            if (ONLINE_JUDGE) {
                solve();
            } else {
                do {
                    try {
                        timeInit();
                        solve();
                        time();

                        out.println();
                        out.flush();
                    } catch (EOFException e) {
                        break;
                    } catch (NullPointerException e) {
                        if (FIRST_INPUT_STRING) break;
                        else throw e;
                    }
                } while (MULTIPLE_TESTS);
            }

            out.close();
            time();
        }catch (Exception e){
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    /////////////////////////////////////////////////////////////////////

    private BufferedReader in;
    private OutputWriter out;
    private StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args){
        new Thread(null, new C(), "", MAX_STACK_SIZE * (1L << 20)).start();
    }

    /////////////////////////////////////////////////////////////////////

    private void init() throws FileNotFoundException{
        Locale.setDefault(Locale.US);

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

    ////////////////////////////////////////////////////////////////

    private long timeBegin;

    private void timeInit() {
        this.timeBegin = System.currentTimeMillis();
    }

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

    @SuppressWarnings("unused")
    private void debug(Object... objects){
        if (ONLINE_JUDGE){
            for (Object o: objects){
                System.err.println(o.toString());
            }
        }
    }

    /////////////////////////////////////////////////////////////////////

    private String delim = " ";

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

    private String readString() {
        while(!tok.hasMoreTokens()){
            String nextLine = readLine();
            if (null == nextLine) throw new EOFException();

            tok = new StringTokenizer(nextLine, delim);
        }

        return tok.nextToken(delim);
    }

    /////////////////////////////////////////////////////////////////

    private final char NOT_A_SYMBOL = '\0';

    @SuppressWarnings("unused")
    private char readChar() {
        try {
            int intValue = in.read();

            if (intValue == -1){
                return NOT_A_SYMBOL;
            }

            return (char) intValue;
        } catch (IOException e) {
            throw new RuntimeIOException(e);
        }
    }

    private char[] readCharArray() {
        return readLine().toCharArray();
    }

    @SuppressWarnings("unused")
    private char[][] readCharField(int rowsCount) {
        char[][] field = new char[rowsCount][];
        for (int row = 0; row < rowsCount; ++row) {
            field[row] = readCharArray();
        }

        return field;
    }

    /////////////////////////////////////////////////////////////////

    private long optimizedReadLong() {
        int sign = 1;
        long result = 0;
        boolean started = false;
        while (true) {
            try {
                int j = in.read();
                if (-1 == j) {
                    if (started) return sign * result;
                    throw new NumberFormatException();
                }

                if (j == '-') {
                    if (started) throw new NumberFormatException();
                    sign = -sign;
                }

                if ('0' <= j && j <= '9') {
                    result = result * 10 + j - '0';
                    started = true;
                } else if (started) {
                    return sign * result;
                }
            } catch (IOException e) {
                throw new RuntimeIOException(e);
            }
        }
    }

    private int readInt() {

        if (!OPTIMIZE_READ_NUMBERS) {
            return Integer.parseInt(readString());
        } else {
            return (int) optimizedReadLong();
        }
    }

    private int[] readIntArray(int size) {
        int[] array = new int[size];

        for (int index = 0; index < size; ++index){
            array[index] = readInt();
        }

        return array;
    }

    @SuppressWarnings("unused")
    private int[] readSortedIntArray(int size) {
        Integer[] array = new Integer[size];

        for (int index = 0; index < size; ++index) {
            array[index] = readInt();
        }
        Arrays.sort(array);

        int[] sortedArray = new int[size];
        for (int index = 0; index < size; ++index) {
            sortedArray[index] = array[index];
        }

        return sortedArray;
    }

    private int[] readIntArrayWithDecrease(int size) {
        int[] array = readIntArray(size);

        for (int i = 0; i < size; ++i) {
            array[i]--;
        }

        return array;
    }

    ///////////////////////////////////////////////////////////////////

    @SuppressWarnings("unused")
    private int[][] readIntMatrix(int rowsCount, int columnsCount) {
        int[][] matrix = new int[rowsCount][];

        for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {
            matrix[rowIndex] = readIntArray(columnsCount);
        }

        return matrix;
    }

    @SuppressWarnings("unused")
    private int[][] readIntMatrixWithDecrease(int rowsCount, int columnsCount) {
        int[][] matrix = new int[rowsCount][];

        for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {
            matrix[rowIndex] = readIntArrayWithDecrease(columnsCount);
        }

        return matrix;
    }

    ///////////////////////////////////////////////////////////////////

    private long readLong() {
        if (!OPTIMIZE_READ_NUMBERS) {
            return Long.parseLong(readString());
        } else {
            return optimizedReadLong();
        }
    }

    @SuppressWarnings("unused")
    private long[] readLongArray(int size) {
        long[] array = new long[size];

        for (int index = 0; index < size; ++index){
            array[index] = readLong();
        }

        return array;
    }

    ////////////////////////////////////////////////////////////////////

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

    @SuppressWarnings("unused")
    private double[] readDoubleArray(int size) {
        double[] array = new double[size];

        for (int index = 0; index < size; ++index){
            array[index] = readDouble();
        }

        return array;
    }

    ////////////////////////////////////////////////////////////////////

    @SuppressWarnings("unused")
    private BigInteger readBigInteger() {
        return new BigInteger(readString());
    }

    @SuppressWarnings("unused")
    private BigDecimal readBigDecimal() {
        return new BigDecimal(readString());
    }

    /////////////////////////////////////////////////////////////////////

    private Point readPoint() {
        int x = readInt();
        int y = readInt();
        return new Point(x, y);
    }

    @SuppressWarnings("unused")
    private Point[] readPointArray(int size) {
        Point[] array = new Point[size];

        for (int index = 0; index < size; ++index){
            array[index] = readPoint();
        }

        return array;
    }

    /////////////////////////////////////////////////////////////////////

    @Deprecated
    @SuppressWarnings("unused")
    private List<Integer>[] readGraph(int vertexNumber, int edgeNumber) {
        @SuppressWarnings("unchecked")
        List<Integer>[] graph = new List[vertexNumber];

        for (int index = 0; index < vertexNumber; ++index){
            graph[index] = new ArrayList<>();
        }

        while (edgeNumber-- > 0){
            int from = readInt() - 1;
            int to = readInt() - 1;

            graph[from].add(to);
            graph[to].add(from);
        }

        return graph;
    }

    private static class GraphBuilder {

        final int size;
        final List<Integer>[] edges;

        static GraphBuilder createInstance(int size) {
            @SuppressWarnings("unchecked")
            List<Integer>[] edges = new List[size];
            for (int v = 0; v < size; ++v) {
                edges[v] = new ArrayList<>();
            }

            return new GraphBuilder(edges);
        }

        private GraphBuilder(List<Integer>[] edges) {
            this.size = edges.length;
            this.edges = edges;
        }

        public void addEdge(int from, int to) {
            addDirectedEdge(from, to);
            addDirectedEdge(to, from);
        }

        public void addDirectedEdge(int from, int to) {
            edges[from].add(to);
        }

        public int[][] build() {
            int[][] graph = new int[size][];
            for (int v = 0; v < size; ++v) {
                List<Integer> vEdges = edges[v];
                graph[v] = castInt(vEdges);
            }

            return graph;
        }
    }

    @SuppressWarnings("unused")
    private final static int ZERO_INDEXATION = 0, ONE_INDEXATION = 1;

    @SuppressWarnings("unused")
    private int[][] readUnweightedGraph(int vertexNumber, int edgesNumber) {
        return readUnweightedGraph(vertexNumber, edgesNumber, ONE_INDEXATION, false);
    }

    private int[][] readUnweightedGraph(int vertexNumber, int edgesNumber,
                                        int indexation, boolean directed
    ) {
        GraphBuilder graphBuilder = GraphBuilder.createInstance(vertexNumber);
        for (int i = 0; i < edgesNumber; ++i) {
            int from = readInt() - indexation;
            int to = readInt() - indexation;

            if (directed) graphBuilder.addDirectedEdge(from, to);
            else graphBuilder.addEdge(from, to);
        }

        return graphBuilder.build();
    }

    private static class Edge {
        int to;
        int w;

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

    @SuppressWarnings("unused")
    private Edge[][] readWeightedGraph(int vertexNumber, int edgesNumber) {
        return readWeightedGraph(vertexNumber, edgesNumber, ONE_INDEXATION, false);
    }

    private Edge[][] readWeightedGraph(int vertexNumber, int edgesNumber,
                                       int indexation, boolean directed) {
        @SuppressWarnings("unchecked")
        List<Edge>[] graph = new List[vertexNumber];
        for (int v = 0; v < vertexNumber; ++v) {
            graph[v] = new ArrayList<>();
        }

        while (edgesNumber --> 0) {
            int from = readInt() - indexation;
            int to = readInt() - indexation;
            int w = readInt();

            graph[from].add(new Edge(to, w));
            if (!directed) graph[to].add(new Edge(from, w));
        }

        Edge[][] graphArrays = new Edge[vertexNumber][];
        for (int v = 0; v < vertexNumber; ++v) {
            graphArrays[v] = graph[v].toArray(new Edge[0]);
        }

        return graphArrays;
    }

    /////////////////////////////////////////////////////////////////////

    private static class IntIndexPair {

        @SuppressWarnings("unused")
        static Comparator<IntIndexPair> increaseComparator = (indexPair1, indexPair2) -> {
            int value1 = indexPair1.value;
            int value2 = indexPair2.value;

            if (value1 != value2) return value1 - value2;

            int index1 = indexPair1.index;
            int index2 = indexPair2.index;

            return index1 - index2;
        };

        @SuppressWarnings("unused")
        static Comparator<IntIndexPair> decreaseComparator = (indexPair1, indexPair2) -> {
            int value1 = indexPair1.value;
            int value2 = indexPair2.value;

            if (value1 != value2) return -(value1 - value2);

            int index1 = indexPair1.index;
            int index2 = indexPair2.index;

            return index1 - index2;
        };

        @SuppressWarnings("unused")
        static IntIndexPair[] from(int[] array) {
            IntIndexPair[] iip = new IntIndexPair[array.length];
            for (int i = 0; i < array.length; ++i) {
                iip[i] = new IntIndexPair(array[i], i);
            }

            return iip;
        }

        int value, index;

        IntIndexPair(int value, int index) {
            super();
            this.value = value;
            this.index = index;
        }

        @SuppressWarnings("unused")
        int getRealIndex() {
            return index + 1;
        }
    }

    @SuppressWarnings("unused")
    private IntIndexPair[] readIntIndexArray(int size) {
        IntIndexPair[] array = new IntIndexPair[size];

        for (int index = 0; index < size; ++index) {
            array[index] = new IntIndexPair(readInt(), index);
        }

        return array;
    }

    /////////////////////////////////////////////////////////////////////

    private static class OutputWriter extends PrintWriter {

        final int DEFAULT_PRECISION = 12;

        private int precision;
        private String format, formatWithSpace;

        {
            precision = DEFAULT_PRECISION;

            format = createFormat(precision);
            formatWithSpace = format + " ";
        }

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

        OutputWriter(String fileName) throws FileNotFoundException {
            super(fileName);
        }

        int getPrecision() {
            return precision;
        }

        void setPrecision(int precision) {
            precision = max(0, precision);
            this.precision = precision;

            format = createFormat(precision);
            formatWithSpace = format + " ";
        }

        String createFormat(int precision){
            return "%." + precision + "f";
        }

        @Override
        public void print(double d){
            printf(format, d);
        }

        @Override
        public void println(double d){
            print(d);
            println();
        }

        void printWithSpace(double d){
            printf(formatWithSpace, d);
        }

        void printAll(double...d){
            for (int i = 0; i < d.length - 1; ++i){
                printWithSpace(d[i]);
            }

            print(d[d.length - 1]);
        }

        @SuppressWarnings("unused")
        void printlnAll(double... d){
            printAll(d);
            println();
        }

        void printAll(int... array) {
        	for (int value : array) {
        		print(value + " ");
        	}
        }

        @SuppressWarnings("unused")
        void printlnAll(int... array) {
        	printAll(array);
        	println();
        }

        void printAll(long... array) {
        	for (long value : array) {
        		print(value + " ");
        	}
        }

        @SuppressWarnings("unused")
        void printlnAll(long... array) {
        	printAll(array);
        	println();
        }
    }

    /////////////////////////////////////////////////////////////////////

    private static class EOFException extends RuntimeException {

        EOFException() {
            super();
        }
    }

    private static class RuntimeIOException extends RuntimeException {

        /**
         *
         */
        private static final long serialVersionUID = -6463830523020118289L;

        RuntimeIOException(Throwable cause) {
            super(cause);
        }
    }

    /////////////////////////////////////////////////////////////////////
    //////////////// Some useful constants andTo functions ////////////////
    /////////////////////////////////////////////////////////////////////

    private static void swap(int[] array, int i, int j) {
        if (i != j) {
            int tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;
        }
    }

    private static final int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
    private static final int[][] steps8 = {
            {-1, 0}, {1, 0}, {0, -1}, {0, 1},
            {-1, -1}, {1, 1}, {1, -1}, {-1, 1}
    };

    @SuppressWarnings("unused")
    private static boolean checkCell(int row, int rowsCount, int column, int columnsCount) {
        return checkIndex(row, rowsCount) && checkIndex(column, columnsCount);
    }

    private static boolean checkIndex(int index, int lim){
        return (0 <= index && index < lim);
    }

    /////////////////////////////////////////////////////////////////////

    private static int getBit(long mask, int bit) { return (int)((mask >> bit) & 1); }

    @SuppressWarnings("unused")
    private static boolean checkBit(long mask, int bit){
        return getBit(mask, bit) != 0;
    }

    /////////////////////////////////////////////////////////////////////

    @SuppressWarnings("unused")
    private static long getSum(int[] array) {
        long sum = 0;
        for (int value: array) {
            sum += value;
        }

        return sum;
    }

    @SuppressWarnings("unused")
    private static Point getMinMax(int[] array) {
        int min = array[0];
        int max = array[0];

        for (int index = 0, size = array.length; index < size; ++index, ++index) {
            int value = array[index];

            if (index == size - 1) {
                min = min(min, value);
                max = max(max, value);
            } else {
                int otherValue = array[index + 1];

                if (value <= otherValue) {
                    min = min(min, value);
                    max = max(max, otherValue);
                } else {
                    min = min(min, otherValue);
                    max = max(max, value);
                }
            }
        }

        return new Point(min, max);
    }

    /////////////////////////////////////////////////////////////////////

    @SuppressWarnings("unused")
    private static boolean isPrime(int x) {
        if (x < 2) return false;
        for (int d = 2; d * d <= x; ++d) {
            if (x % d == 0) return false;
        }

        return true;
    }

    @SuppressWarnings("unused")
    private static int[] getPrimes(int n) {
        boolean[] used = new boolean[n];
        used[0] = used[1] = true;

        int size = 0;
        for (int i = 2; i < n; ++i) {
            if (!used[i]) {
                ++size;
                for (int j = 2 * i; j < n; j += i) {
                    used[j] = true;
                }
            }
        }

        int[] primes = new int[size];
        for (int i = 0, cur = 0; i < n; ++i) {
            if (!used[i]) {
                primes[cur++] = i;
            }
        }

        return primes;
    }

    /////////////////////////////////////////////////////////////////////

    @SuppressWarnings("unused")
    int[] getDivisors(int value) {
        List<Integer> divisors = new ArrayList<>();
        for (int divisor = 1; divisor * divisor <= value; ++divisor) {
            if (value % divisor == 0) {
                divisors.add(divisor);
                if (divisor * divisor != value) {
                    divisors.add(value / divisor);
                }
            }
        }

        return castInt(divisors);
    }

    @SuppressWarnings("unused")
    long[] getDivisors(long value) {
        List<Long> divisors = new ArrayList<>();
        for (long divisor = 1; divisor * divisor <= value; ++divisor) {
            if (value % divisor == 0) {
                divisors.add(divisor);
                if (divisor * divisor != value) {
                    divisors.add(value / divisor);
                }
            }
        }

        return castLong(divisors);
    }

    /////////////////////////////////////////////////////////////////////

    @SuppressWarnings("unused")
    private static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }

    private static long gcd(long a, long b) {
        return (a == 0 ? b : gcd(b % a, a));
    }

    /////////////////////////////////////////////////////////////////////

    private static int[] castInt(List<Integer> list) {
        int[] array = new int[list.size()];
        for (int i = 0; i < array.length; ++i) {
            array[i] = list.get(i);
        }

        return array;
    }

    @SuppressWarnings("unused")
    private static long[] castLong(List<Long> list) {
        long[] array = new long[list.size()];
        for (int i = 0; i < array.length; ++i) {
            array[i] = list.get(i);
        }

        return array;
    }

    /////////////////////////////////////////////////////////////////////

    /**
     * Generates list with keys 0..<n
     * @param n - exclusive limit of sequence
     */
    @SuppressWarnings("unused")
    private static List<Integer> order(int n) {
        List<Integer> sequence = new ArrayList<>();
        for (int i = 0; i < n; ++i) {
            sequence.add(i);
        }

        return sequence;
    }
}


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

public class cf295c {
  static int ones = 0, twos = 0, MAX = 40000;
  static long mod = 1_000_000_007, oo = 987654321;
  public static void main(String[] args) {
    long[][] pasc = new long[150][150];
    for(int i=0; i<150; i++) {
      pasc[i][0] = 1;
      for(int j=1; j<=i; j++)
        pasc[i][j] = (pasc[i-1][j] + pasc[i-1][j-1])%mod;
    }
    FastIO in = new FastIO(), out = in;
    int n = in.nextInt();
    int k = in.nextInt()/50;
    for(int i=0; i<n; i++)
      if(in.nextInt()==50) ones++;
      else twos++;
    int[] start = {0,ones,0,twos,0};
    int[] end = {1,0,ones,0,twos};
    int src = compressState(start);
    long[] dist = new long[MAX];
    long[] dp = new long[MAX];
    Arrays.fill(dist,oo);
    dist[src] = 0;
    dp[src] = 1;
    ArrayDeque<Integer> q = new ArrayDeque<Integer>();
    q.add(src);
    while(!q.isEmpty()) {
      int[] curState = getState(q.poll());
      int cur = compressState(curState);
      if(curState[0] == 0) {
        for(int i=0; i<=curState[1]; i++)
          for(int j=0; j<=curState[3]; j++) {
            if(i+j == 0) continue;
            if(i+2*j > k) continue;
            int[] nextState = new int[]{1-curState[0], curState[1]-i, curState[2]+i, curState[3]-j, curState[4]+j};
            int next = compressState(nextState);
            if(dist[next] > dist[cur] + 1) {
              dist[next] = dist[cur]+1;
              q.add(next);
              dp[next] = 0;
            }
            if(dist[next] == dist[cur]+1) {
              dp[next] = (dp[next] + dp[cur]*((pasc[curState[1]][i]*pasc[curState[3]][j])%mod))%mod;
            }
          }
      }
      else {
        for(int i=0; i<=curState[2]; i++)
          for(int j=0; j<=curState[4]; j++) {
            if(i+j == 0) continue;
            if(i+2*j > k) continue;
            int[] nextState = new int[]{1-curState[0], curState[1]+i, curState[2]-i, curState[3]+j, curState[4]-j};
            int next = compressState(nextState);
            if(dist[next] > dist[cur] + 1) {
              dist[next] = dist[cur]+1;
              q.add(next);
              dp[next] = 0;
            }
            if(dist[next] == dist[cur]+1) {
              dp[next] = (dp[next] + dp[cur]*((pasc[curState[2]][i]*pasc[curState[4]][j])%mod))%mod;
            }
          }
      }
    }
    int dest = compressState(end);
    if(dist[dest] >= oo) dist[dest] = -1;
    out.println(dist[dest]);
    out.println(dp[dest]);
    out.close();
  }
  static int[] getState(int state) {
    return new int[]{state/10000, (state%10000)/100, ones-(state%10000)/100, state%100, twos-state%100};
  }
  static int compressState(int[] state) {
    return state[0]*100*100+state[1]*100+state[3];
  }

  static class FastIO extends PrintWriter {
    BufferedReader br;
    StringTokenizer st;

    public FastIO() {
      this(System.in, System.out);
    }

    public FastIO(InputStream in, OutputStream out) {
      super(new BufferedWriter(new OutputStreamWriter(out)));
      br = new BufferedReader(new InputStreamReader(in));
      scanLine();
    }

    public void scanLine() {
      try {
        st = new StringTokenizer(br.readLine().trim());
      } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
      }
    }

    public int numTokens() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return numTokens();
      }
      return st.countTokens();
    }

    public String next() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return next();
      }
      return st.nextToken();
    }

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

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

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