#include <bits/stdc++.h>
using namespace std;
const long MOD = 1e9 + 7;
int main() {
  int n, m;
  cin >> n >> m;
  vector<long> a(n);
  vector<vector<long>> v(n, vector<long>(n, 0));
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    v[i][i] = a[i];
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < i; j++) {
      v[j][i] = v[j][i - 1] + v[i][i];
    }
  }
  long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; j++) {
      if (v[i][j] % m == 0) ans++;
    }
  }
  cout << ans;
  return 0;
}
