#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[255];
  int b, i, j;
  char *p = NULL;
  cin >> a;
  cin >> b;
  i = strlen(a);
  p = a;
  j = b;
  if (i <= b) {
    cout << a << endl;
  } else {
    for (j = 0; j < b; j++) {
      cout << a[j];
    }
    cout << endl;
  }
  return 0;
}
