#include <bits/stdc++.h>
using namespace std;
struct node {
  int a, c;
} nod[100010];
bool cmp(node a, node b) { return a.c < b.c; }
int main() {
  int n, k;
  while (~scanf("%d%d", &n, &k)) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &nod[i].a);
      nod[i].c = (10 - (nod[i].a) % 10);
    }
    sort(nod + 1, nod + n + 1, cmp);
    for (int i = 1; i <= n; i++) {
      if (k < nod[i].c) {
        break;
      }
      if (nod[i].a + nod[i].c <= 100) {
        nod[i].a += nod[i].c;
        k -= nod[i].c;
      }
    }
    for (int i = 1; i <= n; i++) {
      if (k < 10) {
        break;
      }
      while (nod[i].a + 10 <= 100 && k >= 10) {
        nod[i].a += 10;
        k -= 10;
      }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      ans += (nod[i].a / 10);
    }
    cout << ans << endl;
  }
  return 0;
}
