#include <bits/stdc++.h>
using namespace std;
int n, k;
int ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ans += a[i] / 10;
    a[i] %= 10;
  }
  sort(a, a + n);
  for (int i = n - 1; i >= 0; i--) {
    if (10 - a[i] <= k) {
      k -= 10 - a[i];
      a[i] = 0;
      ans++;
    } else {
      break;
    }
  }
  ans += k / 10;
  cout << min(ans, 10 * n) << endl;
}
