A Research Study to Compare Insulin 287 Once a Week to Insulin Glargine (100 Units/mL) Once a Day in People With Type 2 Diabetes.

The study compares 2 medicines for people with type 2 diabetes: insulin 287 (a new medicine) and insulin glargine (a medicine doctors can already prescribe). The study doctors will test insulin 287 to see how well it works compared to insulin glargine. The study will also test if insulin 287 is safe. The study participants will either get insulin 287 or insulin glargine (100 units/mL) - which treatment the participants get is decided by chance. The participants will need to inject their selves every day about the same time. Once a week the participant will need to take 1 extra injection on the same day of the week. The participants will have 16 clinic visits and 14 phone calls with the study doctor. During the study, the doctors will ask you to: 1) measure your blood sugar every day with a blood glucose meter using a finger prick, 2) write down different information in a paper diary daily and return this to your doctor, 3) wear a medical device to measure your blood sugar all the time for 2 weeks 5 times during the study.


Eligibility Criteria:
Inclusion Criteria:

* Male or female, aged 18-75 years (both inclusive) at the time of signing informed consent
* Diagnosed with type 2 diabetes mellitus greater than or equal to 180 days prior to the day of screening
* HbA1c of 7.0-9.5% (53-80 mmol/mol) (both inclusive) as assessed by central laboratory
* Stable daily dose(s) for 90 days prior to the day of screening of any of the following antidiabetic drug(s) or combination regime(s): Any metformin formulations greater than or equal to 1500 mg or maximum tolerated or effective dose (as documented in subject's medical record) OR Any metformin formulations greater than or equal to 1500 mg or maximum tolerated or effective dose (as documented in subject medical record) with Dipeptidyl peptidase-4 inhibitor (DPP4i) (greater than or equal to half of the maximum approved dose according to local label or maximum tolerated or effective dose (as documented in subject's medical records)
* Insulin naïve. However, short term insulin treatment for a maximum of 14 days prior to the day of screening is allowed, as is prior insulin treatment for gestational diabetes
* Body mass index (BMI) less than or equal to 40.0 kg/m\^2

Exclusion Criteria:

* Any episodes of diabetic ketoacidosis within the past 90 days prior to the day of screening and between screening and randomisation
* Myocardial infarction, stroke, hospitalisation for unstable angina pectoris or transient ischaemic attack within 180 days prior to the day of screening and between screening and randomisation
* Presently classified as being in New York Heart Association (NYHA) Class IV
* Treatment with any medication for the indication of diabetes or obesity other than stated in the inclusion criteria within the past 90 days prior to the day of screening. However, short term insulin treatment for a maximum of 14 days prior to the day of screening is allowed, as is prior insulin treatment for gestational diabetes
* Anticipated initiation or change in concomitant medications (for more than 14 consecutive days) known to affect weight or glucose metabolism (e.g. treatment with orlistat, thyroid hormones, or corticosteroids)
* Uncontrolled and potentially unstable diabetic retinopathy or maculopathy. Verified by a pharmacologically pupil-dilated fundus examination performed by an ophthalmologist or another suitably qualified health care provider within the past 90 days prior to screening or in the period between screening and randomisation