#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, l;
  cin >> n >> k;
  int a[101] = {0};
  string rnd;
  for (int i = 0; i < n; i++) {
    cin >> rnd;
    a[rnd.length()]++;
  }
  cin >> rnd;
  l = rnd.length();
  int sum = 0;
  for (int i = 0; i < l; i++) {
    sum += a[i];
  }
  if ((sum + 1) % k != 0)
    cout << (sum + 1) + ((sum + 1) / k) * 5 << " ";
  else
    cout << (sum + 1) + ((sum) / k) * 5 << " ";
  if ((sum + a[l]) % k != 0)
    cout << (sum + a[l]) + ((sum + a[l]) / k) * 5;
  else
    cout << (sum + a[l]) + ((sum + a[l] - 1) / k) * 5;
  return 0;
}
