#include <bits/stdc++.h>
using namespace std;
bool com(int x, int y) { return (x % 10) > (y % 10); }
int main() {
  long long n, k, sum = 0;
  int a[100005];
  cin >> n >> k;
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  sort(a, a + n, com);
  for (int i = 0; i < n; i++) {
    if (a[i] % 10 == 0) break;
    if (k > (10 - a[i] % 10)) {
      k -= (10 - a[i] % 10);
      a[i] += (10 - a[i] % 10);
    } else if (k <= (10 - a[i] % 10)) {
      a[i] += k;
      k = 0;
      break;
    }
  }
  if (k != 0) {
    for (int i = 0; i < n; i++) {
      if (a[i] != 100 && k > 100 - a[i]) {
        k -= 100 - a[i];
        a[i] = 100;
      } else if (a[i] != 100 && k <= 100 - a[i]) {
        a[i] += k;
        k = 0;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    sum += a[i] / 10;
  }
  cout << sum << endl;
  return 0;
}
