#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, k, min = 1, max;
  string str[100], c;
  cin >> n >> k;
  for (j = 0; j < n; j++) cin >> str[j];
  cin >> c;
  int len;
  len = c.length();
  int count = 0, x = 0;
  for (i = 0; i < n; i++) {
    int len2;
    len2 = str[i].length();
    if (len2 < len)
      count++;
    else if (len2 == len)
      x++;
  }
  if (count < k)
    min = count + 1;
  else {
    int p = count / k;
    min = count + (p * 5) + 1;
  }
  int q;
  int t;
  t = x + count;
  n = t;
  q = n / k;
  if (n == k || n % k == 0)
    max = n + ((q - 1) * 5);
  else
    max = n + (q * 5);
  cout << min << " " << max << endl;
  return 0;
}
