#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int a[MAXN];
bool cmp(int y, int x) { return y % 10 > x % 10; }
int main(void) {
  int n, k;
  cin >> n >> k;
  int sum = 0;
  for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i];
  if (sum + k >= 100 * n) {
    cout << 10 * n;
    return 0;
  }
  int ans = 0;
  sort(a + 1, a + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    ans += a[i] / 10;
    if (k >= 10 - a[i] % 10) {
      ans++;
      k -= 10 - a[i] % 10;
    }
  }
  ans += k / 10;
  cout << ans;
}
