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