#include <bits/stdc++.h>
using namespace std;
const unsigned int M = 1000000007;
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int ans = 0;
    int a[n];
    for (int i = 0; i < k; i++) {
      ans += a[i];
    }
    cout << ans << endl;
  }
  return 0;
}
