#include <bits/stdc++.h>
using namespace std;
int n, k, i;
int oma = 0, omi = 0, ma, mi;
int a[101];
string s;
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> s;
    a[s.size()]++;
  }
  cin >> s;
  for (i = 1; i < s.size(); i++) omi = omi + a[i];
  mi = omi;
  ma = oma;
  omi = 5 * (omi / k) + 1 + omi;
  oma = a[s.size()] + ((a[s.size()] - 1 + mi) / k) * 5 + mi;
  cout << omi << " " << oma << endl;
  return 0;
}
