#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
int print_value(A title, B val) {
  cout << title << " = " << val << "\n";
  return 1;
}
int break_point() {
  char c;
  while ((c = getchar()) != '\n')
    ;
  return 0;
}
template <typename A>
int logg(A v) {
  cout << v << "\n";
  return 0;
}
void read_intq(int &r) {
  r = 0;
  char c;
  while (1) {
    c = getchar();
    if (c != ' ' && c != '\n') {
      r = c - '0';
      break;
    }
  }
  while (1) {
    c = getchar();
    if (c == ' ' || c == '\n') return;
    r = r * 10 + (c - '0');
  }
}
void read_llq(long long &r) {
  r = 0;
  char c;
  while (1) {
    c = getchar();
    if (c != ' ' && c != '\n') {
      r = c - '0';
      break;
    }
  }
  while (1) {
    c = getchar();
    if (c == ' ' || c == '\n') return;
    r = r * 10 + (c - '0');
  }
}
void run();
int main() {
  srand(time(NULL));
  do {
    run();
    if (0) {
      0 ? printf("-------------------------------\n") : 0;
      0 ? printf("-------------------------------\n") : 0;
    }
  } while (0);
  return 0;
}
vector<int> d[11];
void run() {
  int n, k;
  scanf("%d%d", &n, &k);
  int t;
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    d[t % 10].push_back(t);
  }
  int idx = 10;
  int res = 0;
  while (idx > 0) {
    if (d[idx].empty()) {
      idx--;
      sort(d[idx].begin(), d[idx].end());
      continue;
    }
    if (k >= 10 - idx) {
      k -= (10 - idx);
      d[0].push_back(d[idx].back() + 10 - idx);
    } else {
      k = 0;
      res += d[idx].back() / 10;
    }
    d[idx].pop_back();
  }
  int sz = d[0].size();
  for (int i = sz - 1; i >= 0; i--) {
    int x = min(100 - d[0][i], k);
    k -= x;
    d[0][i] += x;
    res += d[0][i] / 10;
  }
  printf("%d", res);
  putchar('\n');
}
