#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, dummy;
  dummy = scanf("%d %d", &N, &A);
  char table[0x100];
  for (int i = 0; i < 0x100; i++) {
    int cnt = 0;
    int val = i;
    while (val != 0) {
      if ((val & 1) != 0) cnt++;
      val >>= 1;
    }
    table[i] = cnt;
  }
  int MAX0 = N / 7;
  int MAX1 = N / 7;
  int MAX2 = N / 7;
  int MAX3 = N / 7;
  int MAX4 = N / 7;
  int MAX5 = N / 7;
  int MAX6 = N - (N / 7) * 6;
  int bitMAX0 = 1LL << MAX0;
  int bitMAX1 = 1LL << MAX1;
  int bitMAX2 = 1LL << MAX2;
  int bitMAX3 = 1LL << MAX3;
  int bitMAX4 = 1LL << MAX4;
  int bitMAX5 = 1LL << MAX5;
  int bitMAX6 = 1LL << MAX6;
  int bit;
  vector<int> vi;
  vector<int> vi0;
  vector<int> vi1;
  vector<int> vi2;
  vector<int> vi3;
  vector<int> vi4;
  vector<int> vi5;
  vector<int> vi6;
  int tmp1;
  for (int i = 0; i < N; i++) {
    dummy = scanf("%d", &tmp1);
    vi.push_back(tmp1 - A);
  }
  sort(vi.begin(), vi.end());
  int index = 0;
  for (int i = 0; i < MAX0; i++) {
    vi0.push_back(vi[index++]);
  }
  for (int i = 0; i < MAX1; i++) {
    vi1.push_back(vi[index++]);
  }
  for (int i = 0; i < MAX2; i++) {
    vi2.push_back(vi[index++]);
  }
  for (int i = 0; i < MAX3; i++) {
    vi3.push_back(vi[index++]);
  }
  for (int i = 0; i < MAX4; i++) {
    vi4.push_back(vi[index++]);
  }
  for (int i = 0; i < MAX5; i++) {
    vi5.push_back(vi[index++]);
  }
  for (int i = 0; i < MAX6; i++) {
    vi6.push_back(vi[index++]);
  }
  map<int, int> mi0;
  map<int, int> mi1;
  map<int, int> mi2;
  map<int, int> mi3;
  map<int, int> mi4;
  map<int, int> mi5;
  map<int, int> mi6;
  for (bit = 0; bit < bitMAX0; bit++) {
    int count = 0;
    int total = 0;
    for (int i = 0; i < MAX0; i++) {
      if (bit & (1 << i)) {
        total += vi0[i];
        count++;
      }
    }
    mi0[total]++;
  }
  for (bit = 0; bit < bitMAX1; bit++) {
    int count = 0;
    int total = 0;
    for (int i = 0; i < MAX1; i++) {
      if (bit & (1 << i)) {
        total += vi1[i];
        count++;
      }
    }
    mi1[total]++;
  }
  for (bit = 0; bit < bitMAX2; bit++) {
    int count = 0;
    int total = 0;
    for (int i = 0; i < MAX2; i++) {
      if (bit & (1 << i)) {
        total += vi2[i];
        count++;
      }
    }
    mi2[total]++;
  }
  for (bit = 0; bit < bitMAX3; bit++) {
    int count = 0;
    int total = 0;
    for (int i = 0; i < MAX3; i++) {
      if (bit & (1 << i)) {
        total += vi3[i];
        count++;
      }
    }
    mi3[total]++;
  }
  for (bit = 0; bit < bitMAX4; bit++) {
    int count = 0;
    int total = 0;
    for (int i = 0; i < MAX4; i++) {
      if (bit & (1 << i)) {
        total += vi4[i];
        count++;
      }
    }
    mi4[total]++;
  }
  for (bit = 0; bit < bitMAX5; bit++) {
    int count = 0;
    int total = 0;
    for (int i = 0; i < MAX5; i++) {
      if (bit & (1 << i)) {
        total += vi5[i];
        count++;
      }
    }
    mi5[total]++;
  }
  for (bit = 0; bit < bitMAX6; bit++) {
    int count = 0;
    int total = 0;
    for (int i = 0; i < MAX6; i++) {
      if (bit & (1 << i)) {
        total += vi6[i];
        count++;
      }
    }
    mi6[total]++;
  }
  long long ans = 0;
  auto end0 = mi0.end();
  auto end1 = mi1.end();
  auto end2 = mi2.end();
  auto end3 = mi3.end();
  auto end4 = mi4.end();
  auto end5 = mi5.end();
  auto end6 = mi6.end();
  for (auto itr0 = mi0.begin(); itr0 != end0; itr0++) {
    for (auto itr1 = mi1.begin(); itr1 != end1; itr1++) {
      for (auto itr2 = mi2.begin(); itr2 != end2; itr2++) {
        for (auto itr3 = mi3.begin(); itr3 != end3; itr3++) {
          for (auto itr4 = mi4.begin(); itr4 != end4; itr4++) {
            for (auto itr5 = mi5.begin(); itr5 != end5; itr5++) {
              for (auto itr6 = mi6.begin(); itr6 != end6; itr6++) {
                int total = itr0->first + itr1->first + itr2->first +
                            itr3->first + itr4->first + itr5->first +
                            itr6->first;
                if (0 == total) {
                  ans += (long long)itr0->second * (long long)itr1->second *
                         (long long)itr2->second * (long long)itr3->second *
                         (long long)itr4->second * (long long)itr5->second *
                         (long long)itr6->second;
                }
              }
            }
          }
        }
      }
    }
  }
  printf("%lld\n", ans - 1);
  return 0;
}
