#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
const int MAXN = 100010;
using namespace std;
int n, k;
struct node {
  int a;
  int dif;
};
node a[MAXN];
int cmp(node a, node b) { return a.dif < b.dif; }
int main() {
  int sum = 0, x;
  bool flag = true;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    a[i].a = x / 10;
    a[i].dif = 10 - x % 10;
  }
  sort(a + 1, a + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    if (a[i].a >= 10 || a[i].dif == 10) continue;
    k -= a[i].dif;
    if (k >= 0)
      a[i].a++;
    else {
      flag = false;
      break;
    }
  }
  for (int i = 1; i <= n; i++) sum += a[i].a;
  if (flag == false)
    cout << sum << endl;
  else {
    sum += k / 10;
    cout << min(sum, n * 10) << endl;
  }
  return 0;
}
