#include <stdio.h>
#include <set>
using namespace std;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int main(){
    int n,ans,temp;
    set<long long int> s;
    scanf("%d%d",&n,&ans);
    n--;
    while(n--){
        scanf("%d",&temp);
        ans=gcd(ans,temp);
    }
    for(long long int i=1;i*i<=ans;i++)if(ans%i==0){
            s.insert(i);
            s.insert(ans/i);
    }
    for(auto u:s)printf("%lld\n",u);
}

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>


int main(){
  int N, M;
  scanf("%d", &N);
  scanf("%d", &M);
  std::vector<int > A(N);
  for (int i=0; i<N; i++){
    scanf("%d", &A[i]);
  }
  int sum=0;
  std::map<int, int> mp;
  mp[0]++;
  long long ans = 0;
  for (int i=0; i<N; i++){
    sum+=A[i];
    sum %= M;
    ans += mp[sum];
    mp[sum]++;
  }
  std::cout << ans << std::endl;
  return 0;
}
 