#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x, c[5001], d[5001];
  cin >> a >> b;
  for (int i = 0; i < a; ++i) {
    cin >> x;
    x -= a;
    for (int j = 0; j <= 5000; ++j) {
      c[j] = 0;
    }
    for (int j = 0; j <= 5000; ++j) {
      if (d[j]) {
        c[j] += d[j];
        c[j + x] += d[j];
      }
    }
    for (int j = 0; j <= 5000; ++j) {
      d[j] = c[j];
    }
  }
  cout << d[2500];
}
