#include <bits/stdc++.h>
using namespace std;
class MYCP {
 public:
  static string MakeString_LongLong(vector<long long> const& numbers,
                                    string const& str) {
    if (numbers.size() == 0) return "";
    string result = "" + to_string(numbers[0]);
    for (long long i = 1; i < numbers.size(); i++) {
      result += str;
      result += to_string(numbers[i]);
    }
    return result;
  }
  static string MakeString_LongLong(vector<long long> const& numbers) {
    if (numbers.size() == 0) return "";
    string result = "" + to_string(numbers[0]);
    for (long long i = 1; i < numbers.size(); i++) {
      result += " ";
      result += to_string(numbers[i]);
    }
    return result;
  }
  static string MakeString_VectorString(vector<string> const& str) {
    string result = "";
    for (long long i = 0; i < str.size(); i++) {
      result += str[i] + "\n";
    }
    return result;
  }
  static vector<string> MyReadLineSplit(long long n) {
    vector<string> str(n);
    for (long long i = 0; i < n; i++) {
      std::cin >> str[i];
    }
    return str;
  }
  static vector<long long> ReadInts(long long number) {
    vector<long long> a(number);
    for (int i = 0; i < number; i++) {
      std::cin >> a[i];
    }
    return a;
  }
  static bool PrimeCheck_Int(long long number) {
    if (number < 2) return false;
    for (unsigned long long i = 2; i * i <= number; i++) {
      if (number % i == 0) return false;
    }
    return true;
  }
  static vector<long long> MakePrimeList(long long n) {
    vector<long long> list;
    long long i, j, p;
    bool flag;
    for (i = 2; i <= n; i++) {
      flag = true;
      for (j = 0; j < list.size(); j++) {
        if (!(list[j] * list[j] <= i)) break;
        if (i % list[j] == 0) {
          flag = false;
          break;
        }
      }
      if (flag) list.push_back(i);
    }
    return list;
  }
  static vector<string> split(string const& str, char sep) {
    vector<std::string> v;
    auto first = str.begin();
    while (first != str.end()) {
      auto last = first;
      while (last != str.end() && *last != sep) last++;
      v.push_back(string(first, last));
      if (last != str.end()) last++;
      first = last;
    }
    return v;
  }
  static long long Sum(vector<long long> a) {
    long long i, sum = 0;
    for (i = 0; i < a.size(); i++) {
      sum += a[i];
    }
    return sum;
  }
  static bool Komoji(char a) {
    if (a >= 'a' && a <= 'z') return true;
    return false;
  }
  static bool Oomoji(char a) {
    if (a >= 'A' && a <= 'Z') return true;
    return false;
  }
  static void SetUp() {
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
};
class Syakutori {
 private:
  vector<long long> list;

 public:
  void MakeArray(vector<long long> data) {
    long long i;
    list = data;
    list.push_back(0);
    list[0] = 0;
    for (i = 1; i < list.size(); i++) {
      list[i] = list[i - 1] + data[i - 1];
    }
  }
  long long Sum(long long start, long long end) {
    if (end < start) {
      cout << "startがendより大きいです";
      return 0;
    }
    if (start < 0 || end >= list.size()) {
      cout << "範囲が異常";
      return 0;
    }
    return list[end] - list[start];
  }
};
long long maxD(vector<double> a) {
  long long i, result;
  double max;
  result = 0;
  max = a[0];
  for (i = 0; i < a.size(); i++) {
    if (max < a[i]) {
      max = a[i];
      result = i;
    }
  }
  return result;
}
long long minLL(vector<long long> a) {
  long long i, result;
  long long min;
  result = 0;
  min = a[0];
  for (i = 0; i < a.size(); i++) {
    if (min > a[i]) {
      min = a[i];
      result = i;
    }
  }
  return result;
}
long long function(long long score, long long i, long long p, long long c) {
  long long j, count = 0;
  for (j = 1; j <= p; j++) {
    count += i * 100;
    if (score <= count) return j;
  }
  return p;
}
int main(void) {
  MYCP::SetUp();
  long long i, j, k, n, m, count = 0, x, y, z;
  cin >> n >> m;
  auto a = MYCP::ReadInts(n);
  Syakutori b;
  b.MakeArray(a);
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      x = b.Sum(i, j + 1);
      if (x % m == 0) count++;
    }
  }
  cout << count << endl;
}
