unsigned long int k = 512 * 1024ul;
From the Arduino reference on Integer Constants.
https://www.arduino.cc/reference/en/language/variables/constants/integerconstants/
Notes and Warnings
U & L formatters:By default, an integer constant is treated as an int with the attendant limitations in values. To specify an integer constant with another data type, follow it with:
a 'u' or 'U' to force the constant into an unsigned data format. Example: 33u
a 'l' or 'L' to force the constant into a long data format. Example: 100000L
a 'ul' or 'UL' to force the constant into an unsigned long constant. Example: 32767u