#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  long long a[100010];
  long long sum[100010];
  int count = 0;
  cin >> N >> M;
  for (int i = 0; i < N; ++i) cin >> a[i];
  for (int i = 0; i < N; ++i) {
    sum[i] = 0;
    for (int j = 0; j <= i; ++j) sum[i] += a[j];
    if (sum[i] % M == 0) count++;
  }
  for (int i = 1; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      sum[j] -= a[i - 1];
      if (sum[j] % M == 0) count++;
    }
  }
  cout << count << endl;
}
