#include <stdio.h>
int check(long long);
int solve(void);
 
int n,k;
long long W[100000];
 
int main(){
  int i,P;
  scanf("%d %d",&n,&k);
  for(i = 0; i < n; i++){
  scanf("%d",&W[i]);
}
  P = solve();
  printf("%d\n",P);
  return 0;
}

int CanLay(int n, int k, int m, int *weight)
{
    int i;
    int stack = 0;
    int numTracks = 1;
 
    for(i = 0; i < n; i++)
    {
        if(weight[i] > m) return 0;
        stack += weight[i];
        if(stack > m)
        {
            stack = weight[i];
            numTracks++;
        }
    }
    if(numTracks <= k) return 1;
    else return 0;
}