#include <bits/stdc++.h>
using namespace std;
long long dp[100002];
long long s[100002];
int main() {
  int i, j, n, m, flag = 0;
  cin >> n >> m;
  dp[0] = 0;
  cin >> s[1];
  dp[1] = s[1];
  for (i = 2; i <= n; i++) {
    scanf("%d", &s[i]);
    dp[i] = s[i] + dp[i - 1];
  }
  long long cnt = 0;
  for (i = 1; i <= n; i++) {
    for (j = i; j <= n; j++) {
      if (i == j) {
        if (s[i] % m == 0) {
          cnt++;
        }
      } else {
        if ((dp[j] - dp[i - 1]) % m == 0) {
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
