#include <stdio.h>
int main()
{
    int N, i, k, x;
    x=0;
    scanf("%d",&N);
    scanf("%d",&k);
    int A[N];
    for ( i = 0; i < N; i++ )
    {
      scanf("%d", &A[i]);
    }
    if(k==0)
    {
    for ( i = 0; i < N; i++ )
    {
      x=x+A[i];
    }
    }
    printf("%d",x);
    return 0;
}