#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
long long sum[maxn] = {0}, n, m;
void __init__() {
  int jibang;
  for (int i = 1; i <= n; i++) {
    cin >> jibang;
    sum[i] = sum[i - 1] + jibang;
  }
}
int main() {
  cin >> n >> m;
  long long ans = 0;
  __init__();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++) {
      if (i == j || j == i - 1) {
        if (sum[i] - sum[i - 1] % m == 0) ans++;
      }
      if ((sum[i - 1] - sum[j]) % m == 0) ans++;
    }
  cout << ans;
}
