#include <bits/stdc++.h>
using namespace std;
string p[105] = {""};
int cts[105] = {0};
string pass;
int main(int argc, char const *argv[]) {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
    int xx = p[i].length();
    cts[xx]++;
  }
  for (int i = 1; i <= 100; i++) {
    cts[i] += cts[i - 1];
  }
  cin >> pass;
  int plen = pass.length();
  int mans = cts[plen - 1];
  mans += 5 * (mans / k);
  mans++;
  cout << mans << " ";
  int maxans = cts[plen] - 1;
  maxans += 5 * (maxans / k);
  maxans++;
  cout << maxans << "\n";
  return 0;
}
