#include <bits/stdc++.h>
using namespace std;
int a[100005];
int cmp(int x, int y) {
  int x1 = 10 - x % 10;
  int y1 = 10 - y % 10;
  return x1 < y1;
}
int main() {
  int i, n, m;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + 1 + n, cmp);
  for (i = 1; i <= n; i++) {
    if (a[i] == 100) continue;
    int x = 10 - a[i] % 10;
    if (m < x) {
      a[i] += m;
      m = 0;
      break;
    }
    a[i] += x;
    m -= x;
  }
  int s = 0;
  for (i = 1; i <= n; i++) {
    s += a[i] / 10;
  }
  if (m > 0) {
    for (i = 1; i <= n; i++) {
      if (m + a[i] >= 100) {
        s += (100 - a[i]) / 10;
        m -= (100 - a[i]);
      } else {
        s += m / 10;
        m = 0;
        break;
      }
    }
  }
  cout << s << endl;
}
