#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, w;
cin >> n >> w;
-- w; // 需要mod7,因此周三用2表示,w需要减一
int res1 = 0, res2 = 0;
for(int i = 1; i <= n; ++ i, (++ w) %= 7)
{
int tmp;
cin >> tmp;
if(tmp >= 35)
{
if(w == 3) ++ res2;
else ++ res1;
}
}
cout << res1 << " " << res2 << endl;
return 0;
}