#include <bits/stdc++.h>
using namespace std;
int num[110];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  memset(num, 0, sizeof(num));
  for (int i = 0; i < n; i++) {
    char s[110];
    scanf("%s", s);
    num[strlen(s)]++;
  }
  char str[105];
  scanf("%s", str);
  int l = strlen(str);
  int ans1 = 0, ans2 = 0, sum = 0;
  for (int i = 0; i < l; i++) sum += num[i];
  ans1 = sum;
  if (ans1 >= k) {
    int tmp = ans1;
    ans1 += 5 * (tmp / k);
  }
  ans1++;
  ans2 = sum + num[l] - 1;
  if (ans2 >= k) {
    int tmp = ans2;
    ans2 += 5 * (tmp / k);
  }
  ans2++;
  printf("%d %d\n", ans1, ans2);
  return 0;
}
