#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  char s[101];
  int l[n];
  for (auto i = 0; i != n; i++) {
    scanf("%s", s);
    l[i] = strlen(s);
  }
  scanf("%s", s);
  int n1 = strlen(s), sum = 0, sum1 = 0;
  sort(l, l + n);
  for (auto i = 0; i != n; i++) {
    if (l[i] < n1)
      sum++;
    else if (l[i] == n1)
      sum1++;
    else
      break;
  }
  sum1 += sum;
  printf("%d %d\n", sum + (sum / k) * 5 + 1, sum1 + ((sum1 - 1) / k) * 5);
  return 0;
}
