#include <bits/stdc++.h>
using namespace std;
const static long long int MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};
int main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long int n, m;
  cin >> n >> m;
  vector<long long int> cum(n + 1);
  cum[0] = 0;
  for (int i = 0; i < n; ++i) {
    long long int a;
    cin >> a;
    cum[i + 1] = cum[i] + a;
  }
  long long int ans = 0;
  for (int i = 0; i < n + 1; ++i) {
    for (int j = i + 1; j < n + 1; ++j) {
      if ((cum[j] - cum[i]) % m == 0) ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}
