#include <iostream>

using namespace std;

const int MAX_N = 100000;

long long int table[MAX_N][MAX_N] = {};
long long int n, m;
int a[MAX_N];

void solve() {
  // 対角線上の値決定
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    table[i][i] = a[i];
    if (table[i][i] % m == 0) ans++;
  }

  for (int from = 0; from < n; from++) {
    for (int to = from + 1; to < n; to++) {
      table[from][to] = table[from][to-1] + a[to];
      if (table[from][to] % m == 0) ans++;
    }
  }

  cout << ans << endl;

  return;
}

int main(void) {
  cin >> n;
  cin >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  solve();
}

